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
Tried with below:
@Override
protected void writeLayer(SlingHttpServletRequest request, SlingHttpServletResponse response, ImageContext context, Layer layer)
throws IOException, RepositoryException {
double quality;
quality = 0.8;//getImageQuality();
LoggerUtil.debugLog(this.getClass(),"Image Quality is {}",quality);
writeLayer(request, response, context, layer, quality);
}
Updated Quality with 0.5 but still we are getting increases size of the image than orginal size. Width & Height of the image is same but the size is more.
Could you please help me.
Views
Replies
Total Likes
I am looking to see if we can find an example for you.
Views
Replies
Total Likes
See the example here - it may point you in the correct direction of working with AbstractImageServlet:
http://cq5cms.blogspot.ca/2014/07/render-image-rendtions-dynamically-in.html
Views
Replies
Total Likes
Here is feedback from our team:
They could take a look at the NamedImageTransformServlet .. its sort of a variation of the AbstractImageServlet and provides a customizable rendition picker (so you could configure via OSGi the picker to be ‘original’ and have that picked as the source image.)
Views
Replies
Total Likes
Views
Replies
Total Likes
@basetti, jvm 1.8 and trying to decrease size of .png?
Regards,
Peter
Views
Replies
Total Likes
Hi, we are using AEM 5.6 & Java 1.7
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies