Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PNG Compression [closed]

Some PNG images although just 150px x 160px wide have 60KB filesize. I've already run them though optimizers (ImageOptim for Mac) but that didn't help much.

Is there any way to compress it further, either manually or using some other tool? 60KB for a normal 150x160 image is really unacceptable and I can't use JPG or GIF there because I need transparency.

I tried exporting the PNGs as 8-bit PNG and the filesize has reduced significantly!

like image 268
eozzy Avatar asked Nov 28 '22 15:11

eozzy


2 Answers

This has to do with how PNG compression works.

Unlike JPEG, PNG is a lossless format, position-wise, but not necessarily color-wise.

That is - while JPEG stores transitioning of colors from one area to another, PNG stores the data pixel by pixel and then losslessly compresses this data.

The difference between GIF and PNG actually comes from traditional conventions -- GIF was traditionally saved as 8-bit whereas PNG, which came later, was often saved as 32-bit (true color + alpha/transparency). So, the 32-bit image will require four times as much uncompressed data per pixel, and depending on the specifics of the image, the more detailed the data, the worse it compresses losslessly.

Hence, if you were to compare a 8-bit PNG to a 8-bit GIF, the file sizes should be very similar. The same applies with true color PNG vs true color GIF. This explains why selecting the 8-bit option will solve the file size issue. Otherwise, it's effectively a compressed BMP.

like image 120
marklu Avatar answered Dec 11 '22 04:12

marklu


Have you tried PNGOUT?

like image 38
Scott Avatar answered Dec 11 '22 05:12

Scott