Strange behavior with CMYK JPEGs in PDFs

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
FlashFan
Posts: 13
Joined: 2011-01-05T03:41:09-07:00
Authentication code: 8675308

Strange behavior with CMYK JPEGs in PDFs

Post 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!
Post Reply