how to set color profile

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
jstph
Posts: 31
Joined: 2011-01-27T10:07:43-07:00
Authentication code: 8675308

how to set color profile

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