Image conversion : RGBA to RGB

c++, rgb

Solution

Just copy the data and skip the unused alpha bytes.

If speed is important for you, you may want to use SSE or MMX and use the built-in bit-shuffling instructions. That is usually a bit faster than ordinary c-code.

5 megapixels doesn't sound like that much of data unless you have to do it at 100fps though.

Problem

assuming i had RGBA (32 bits) output from frame-grabber, with alpha channel unused (values retained while filled by frame-grabbers), is there any effective conversion method to RGB (24 bits) ? I am dealing with 5 MegaPixels streaming images so speed does matter too. keep in mind that data in alpha channel can be discarded.

Original source