Page 1 of 1

Strange behavior with CMYK JPEGs in PDFs

Posted: 2011-01-26T09:28:26-07:00
by FlashFan
Hi guys

I'm developing a program wich extracts and modifies images in PDF files. I´ve noticed a strange behavior when I try to load JPEG images with CMYK colorspaces and try to convert them to RGB images. The colors are completely wrong. To change the colorspace I simply saved the image as a BMP file.

I use this code:

Code: Select all

string img = obj->Stream(); //img contains the image data
Blob * blob = new Blob((const void*)img.c_str(),img.length());
Image * image = new Image(*blob);
image->write("cmyk.jpg");
image->write("rgb.bmp");
This results in this images:
Imagecmyk.jpg displayed in windows explorer
Imagergb.bmp displayed in windows explorer
Imageoriginal image in pdf

What can be my mistake?

Thank you for any help!