Jump to content

PNG Image filesize after upload issue


humanafterall
 Share

Recommended Posts

Hi,

I'm getting some odd filesize issues with PNGs when uploading to Processwire.

I've optimised a PNG down to 260kb using Save for Web + ImageOptim.

Original image for upload

Once it has been resized by Processwire the filesize skyrockets to 7mb+

Resized image by Processwire

I've tried playing with the 'quality' setting but all it seems to do is degrade the quality of the image but the file size stays exactly the same.

Does anyone know what might be happening here to make a resized PNG such a huge filesize compared to the original?

Thanks!

Link to comment
Share on other sites

When compressing the PNG image with ImageOptim (and the underlaying programms) you reduce e.g. the color depth of each pixel indivually, you remove full alpha transparency on complete transparent pixels and you reduce the color palette. Lots of stuff happens and basically the whole file is "repacked".

ProcessWire isn't (and can't be) that intelligent. When resizing you create a new PNG file without all those optimization. ProcessWire reads the file and puts the image content into a new file using the full 24bit for every pixel of the PNG file. As you have already noticed, the quality settings don't have that much of an effect on the final image size.

You would have to use ImageOptim again on the thumbnail.

And as a shameless self promotion: There is our ProcessImageMinimize module/service which does exactly the same as ImageOptim but directly "on the fly" with ProcessWire. With the next version launching this weekend, you can minimize up to 2000 images for free.

  • Like 6
Link to comment
Share on other sites

When compressing the PNG image with ImageOptim (and the underlaying programms) you reduce e.g. the color depth of each pixel indivually, you remove full alpha transparency on complete transparent pixels and you reduce the color palette. Lots of stuff happens and basically the whole file is "repacked".

ProcessWire isn't (and can't be) that intelligent. When resizing you create a new PNG file without all those optimization. ProcessWire reads the file and puts the image content into a new file using the full 24bit for every pixel of the PNG file. As you have already noticed, the quality settings don't have that much of an effect on the final image size.

You would have to use ImageOptim again on the thumbnail.

And as a shameless self promotion: There is our ProcessImageMinimize module/service which does exactly the same as ImageOptim but directly "on the fly" with ProcessWire. With the next version launching this weekend, you can minimize up to 2000 images for free.

Philipp,

Thanks for the info - I understand now why Processwire was outputting PNGs at big filesizes.

I'm just testing out your service - so far so good!

Link to comment
Share on other sites

Oh, another one!  :)

It is very disadvantageous to use the param "quality" for the quality / compression of jpegs and the compression of pngs

because there is no quality setting for pngs. (Pngs are lossless)!

I don't use pngs myself because of their lack of supporting common metadata. And therefor I haven't realized how disadvantageous the current handling is.

We definitely need to regulate this independently:

a) different settings, one for quality (jpegs) and one for the png compression,

OR B) we only use quality for jpegs and set the compression level for pngs hardcoded to 9 (highest compression). <= Why not? Is there any reason why someone want to send the exact same visual quality with larger amount of data?

----------

EDIT:

Its unbelievable: http://images.pw.nogajski.de/image-sizer-core/formats/quality-vs-compression/

Edited by horst
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...