Page 1 of 1

how to set color profile

Posted: 2011-07-12T09:19:34-07:00
by jstph
I try to set color profile for decoding a jpeg with CMYK color space. It looks like I need to set a color profile in order to get a correct color transform.
I look through the source code and seems like ImageInfo->profile is the place to set the color profile. So I created a StringInfo* with my icc profile, and assigned to ImageInfo->profile. The color profile doesn't take effect at all. The following code is how I set the color profile. I don't know if I did it totally wrong or not.

StringInfo* profile = new StringInfo();
char * pname = "cmykprofile.icc";
int clen = strlen(pname);
profile->datum = new unsigned char[clen+1];
memcpy(profile->datum, pname, sizeof(char), clen+1);
profile->length = clen+1;
profile->signature = MagickSignature;
ImageInfo* _imageInfo = AcquireImageInfo();
_imageInfo->profile = profile;
(...read image...)

Thanks in advance.