getServingUrl is a convenient way to get images from the AppEngine data store, but it looks like it wants to automatically convert the image.
For example, if I do this:
ServingUrlOptions servingUrlOptions = ServingUrlOptions.Builder.withBlobKey(blobKey); String payload = "{ \"image\" : \"" + mImagesService.getServingUrl(servingUrlOptions) + "\" }";
I get the url of the resized image. For example, if I upload a 960 x 640 image, by default the URL will point me to a 512 x 341 image.
So you say apply the conversion in the url and install s960. This returns a 960 x 640 image, but it has been converted - you can see artifacts in the image if you compare it with the original.
The server saves the image accordingly, thanks to the method I found here to crop to its original size:
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());
I didnβt actually see if it contains the original bytes or not, but it doesnβt really matter, because if I was going to just send the bytes back, I could just pull the data directly from the storage and set it as a payload for the servlet serving a custom image.
Having written this, I understand that this is more like a function request than a question, so I will formulate it as follows: is there a better solution for servicing original images than through my own servlet?