Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice for PNG optimization?

I 'd like to prepare my PNGs for the best optimization, so I can get the best image quality (lossless if possible) and the smallest size.

From what I understand, I should use: PNG, 72 dpi, RGB, but what else?

Here is what we find in the iPhone HIG:

Note:*The standard bit depth for icons and images is 24 bits (8 bits each for red, green, and blue), plus an 8-bit alpha channel. The PNG format is recommended, because it preserves color depth and supports an embedded alpha channel.

I guess this mean we should save the image as PNG 24 and create them in 8 bits mode? But I also read about 32 bits for best quality ?

The interlacing scheme (witch add to the file size) allows for the PNGs to display faster. Does this applies to the iPhone?

Thanks.

like image 440
user287106 Avatar asked Jan 29 '26 17:01

user287106


2 Answers

I suggest using ImageAlpha (lossy) on as many images as you can, because it greatly reduces their size.

Optimize all images with ImageOptim — it will remove all invisible junk and re-compress the data.

Disable Xcode conversion, because it undoes other optimisations and can make images much slower to load.

like image 192
Kornel Avatar answered Feb 01 '26 09:02

Kornel


24 bit is red, green and blue with 8 bits each. 32 bits is RGB plus an 8-bit alpha channel. So if you need (semi-)transparent images, you should go for 32bit PNG, otherwise 24bit.

You don't have to compress/crush the PNGs yourself, Xcode's build steps will automatically use pngcrush and re-order the color channels for the iPhone's BGR memory alignment.

like image 40
MrMage Avatar answered Feb 01 '26 08:02

MrMage



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!