Get original rendition of an image uploaded in DAM using AbstractImageServlet
We have written a custom servlet by extending the AbstractImageServlet and registered it against a custom selector and we are overriding the createLayer method . Returning a layer either from the image or after getting the layer from original rendition of the image does not return the original size of the image
Image img=new Image(imageContext.resource); Layer layer=img.getLayer(true, true, true); return layer;or
Resource imgResource = imageContext.request.getResourceResolver() .getResource(imagePath); Layer layer=imgResource.getLayer(true, true, true); return layer;where imagePath is the path of original rendition of the image
or
Asset asset = imageResource.adaptTo(Asset.class); Rendition original = asset.getOriginal(); Layer layer = new Layer(original.getStream());
The size of the original rendition of image in DAM is 258 KB
but the size of the image returned by the servlet after getting the layer from the original rendition is 713KB. The height and width are the same as original rendition (2048*1100)
As per our understanding; the layer returned from the original rendition of image through custom servlet should have the exact same height;width and size as that of the original rendition in DAM.
How can we get the original image's natural size by extending the AbstractImageServlet ?
Edit: Used getLayer(false, false, false);
It also returns the same result.