libsdl-org / SDL_image

Image decoding for many popular formats for Simple Directmedia Layer.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Return CMYK JPEGs in RGBA32 surface

s09bQ5 opened this issue · comments

When libjpeg is used to decode JPEG files, every image with 4 components is decoded as CMYK data into a BGRA surface. But the de-facto standard for CMYK in JPEG is to invert the color components. So instead of C, M, Y, and K the stored values are 255-C, 255-M, 255-Y, and 255-K. Since lack of cyan is red, lack of magenta is green and lack of yellow is blue, the picture is basically RGBA over a black background. I therefore suggest to use an RGBA32 surface instead of a BGRA32 surface for 4 component JPEG images.

For testing this file can be used: https://static.universal-music.de/asset_new/6890/195/view/cascada-whatdoyouwant-cover-300cmykjpg.jpg