title: Getting the original image back with ImageServices getServingUrl
body: <p>getServingUrl is a convenient way to get images from the AppEngine datastore, but it seems to want to auto-transform the image.</p>
  
  <p>For example, if I do this:</p>
  
  <pre><code>ServingUrlOptions servingUrlOptions = ServingUrlOptions.Builder.withBlobKey(blobKey);
  String payload = "{ \"image\" : \"" + mImagesService.getServingUrl(servingUrlOptions) + "\" }";
  </code></pre>
  
  <p>I get a URL to an image with resized dimensions. For example, if I upload a 960 x 640 image, the default URL will point me to a 512 x 341 image.</p>
  
  <p>So, you say, apply a transform in the URL and set s960. This does return a 960 x 640 image, but it has been transformed -- you can see artifacts in the image if you compare it to the original.</p>
  
  <p>The server is storing the image appropriately, thanks to a technique I found <a href="https://groups.google.com/forum/?fromgroups=#!topic/google-appengine-java/RNvaH2RAjJs" rel="nofollow">here</a> of doing a crop to the original size:</p>
  
  <pre><code>Image image = ImagesServiceFactory.makeImageFromBlob(blobKey);
  Transform noOpCrop = ImagesServiceFactory.makeCrop(0, 0, 1, 1);
  image = mImagesService.applyTransform(noOpCrop, image);                     
  LOGGER.info("Stored image " + image.getWidth() + ", " + image.getHeight());
  </code></pre>
  
  <p>I haven't actually looked to see if this contains the original bytes or not, but it doesn't really matter because if I'm going to just be sending bytes back, I might as well just pull the data straight out of the store and set it as the payload of a custom image serving servlet.</p>
  
  <p>Writing this I'm realizing it sounds more like a feature request than a question, so I'll pose it this way: is there a better solution to serving original images than via a custom servlet?</p>