I'm currently doing some image manipulation stuff in C# and I'm confused about the Bgr32 Pixel format. The following descriptions are from microsoft msdn: http://msdn.microsoft.com/en-us/library/system.windows.media.pixelformats(v=vs.110).aspx
3 channels each 8 bits -> 3x8bit = 24bit
What is/are the last channel/the remaining 8bits for?
Thanks in advance
It is not used but having a color represented as an integer has practical reasons whether for reading or writing, it is aligned.
In the end it represents a 24 bit color and the closest type to represent it being a 32 bit integer. It would be a little weird to represent such color with two integers: a 16 bit (short) integer and an 8 bit (byte) integer.
Now 25% of space is not used, which is a waste ultimately.
Compared to RGB24 it makes more sense to use it in the way that a color is represented by one integer where as on the former it is necessarily 3 bytes. Obviously you have to unpack it to get the different components but these operations are really cheap today.
Personally I would use RGB24 only if there are memory constraints or any other type of constraint such as hardware for instance. Anything else I'd go RGBA and even PBGRA since it has many benefits such as transparency and spares extra calculations during blitting operations and better blending for transparent contours.
For the benefits such representation can offer to you I'd suggest you to take a look at this question : Pre-multiplied alpha compositing (take a look at the results I've posted)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With