How many bits per component do you have to specify for 24-bit pngcrunch-optimized PNG files with alpha transparency?

CGBitmapContextCreate takes a parameter that isn't very obvious to me:

For example, for a 32-bit pixel format and RGB color space, you would specify 8 bits per component.

I created 24-bit PNG files with alpha transparency and added them to Xcode. At compile time, Xcode will optimize these PNG tiles using pngcrunch.

So, when trying to make a graphics context from such an image file on iPhone-OS, I need to specify a bit per component.

In this case, I would say they are 4 bits per component, although I don't know if alpha counts as a component.

0


a source to share


1 answer


This is 8 bits per component:

Red:8;
Green:8;
Blue:8;
Alpha:8;

      



This adds up to 32 bits per pixel. Your 24-bit PNG with 24-bit transparency for RGB plus 8-bit for transparency ("alpha channel").

+5


a source







All Articles