Page 2 of 2
Re: Why do PNG images have so much "extra" data?
Posted: Tue Dec 08, 2015 7:21 am
by slime
PNGs have several options for the type of data they contain (32 bit RGBA, 64 bit RGBA, 24 bit RGB, 8 bit greyscale, indexed palette, etc.)
PNGs also use the same type of compression (zlib/DEFLATE) that many zip files have - which supports various amounts of compression. Those factors allow for different PMG images that look the same to take up much different amounts of space.
Re: Why do PNG images have so much "extra" data?
Posted: Wed Dec 09, 2015 6:25 am
by Jasoco
Well I just discovered one drawback to crushing my images. It removed all the opacity from my pixels. At least most of the image files.
Thankfully I have backups. Guess I'll go back. Didn't even notice it until now.
Re: Why do PNG images have so much "extra" data?
Posted: Wed Dec 09, 2015 6:37 am
by pgimeno
Weird. I tried with pngcrush and trimage, and both preserved alpha. I start to wonder if ImageOptim does something else, e.g. quantization (creating indexed images with palette) like other lossy compressors do, e.g. pngquant.
Re: Why do PNG images have so much "extra" data?
Posted: Wed Dec 09, 2015 7:17 am
by airstruck
More likely it stripped out a
tRNS chunk that was being used in an indexed image. Pngquant does a good job of preserving alpha, but indexed images need the tRNS chunk for that, and since tRNS is considered ancillary something that strips out chunks might get rid of it.
That's not something pngcrush would normally do without being asked, but maybe these frontends are more aggressive about removing chunks?
Re: Why do PNG images have so much "extra" data?
Posted: Wed Dec 09, 2015 7:39 am
by Jasoco
Well apparently there's preferences for this app. And there's a lot of settings in here. I'll have to play around and see if one controls what happened. There's a quality setting too actually.