[opencms-dev] Image wrongly scaled and getting larger on weight instead of lower when extension is .png

Malu malupolo at gmail.com
Tue Dec 20 16:49:06 CET 2022


Hi



We have discovered and issue with the image scaler which we don’t know if
it is a bug or else.

He have an image (.png) of weight 529kb and a width of 1920px, which we
scale with the interface *CmsImageScaler* like this:



*CmsImageScaler scaler = new CmsImageScaler();*

*scaler.setWidth(Integer.parseInt(width));   // <-----width is set to
1110px*

*atributoSRC = cms.link(thumbnail + "?__scale=" + scaler.toString());*



What we get in result is a copy correctly scaled to width passed (1110px)
but its weight is tripled to 1.67Mb and we suppose it should be lower
weight than the original since it has less in number of pixels as width.



We have discovered that this issue doesn’t occur when image is extension
.jpg, which correctly produces a much lower weight image. In fact if we
change the original image extension from .png to .jpg it produces an image
of 314Kb.



Do you think this might be a bug?



Thank you, kind regards



Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opencms.org/pipermail/opencms-dev/attachments/20221220/802d4cbd/attachment.htm>


More information about the opencms-dev mailing list