magick++ convert CMYK to RGB

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.

magick++ convert CMYK to RGB

Postby luwenbin » 2009-08-17T21:47:18+00:00

hi magick
I know how to use IM tool to covert a CMYK image to RGB, like this
" convert cmyk.jpg -profile USWebCoatedSWOP.icc -profile RGB.icc rgb.jpg".
But I want to know how to implement this funtion using magick++ APIs, could anyone give me some help? Many thanks!
luwenbin
 

Re: magick++ convert CMYK to RGB

Postby luwenbin » 2009-08-18T21:03:08+00:00

No one knows?
luwenbin
 

Re: magick++ convert CMYK to RGB

Postby fmw42 » 2009-08-18T22:30:44+00:00

try posting to viewforum.php?f=6
User avatar
fmw42
 
Posts: 14873
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: magick++ convert CMYK to RGB

Postby magick » 2009-08-19T06:00:15+00:00

Try image.profile( "ICM", myProfile ) where myProfile is a blob. If your image does not already have a color profile associated with it, it assigns the profile. If it already has a profile it transforms the colorspace as dictated by both color profiles.
User avatar
magick
Site Admin
 
Posts: 9660
Joined: 2003-05-31T11:32:55+00:00

Re: magick++ convert CMYK to RGB

Postby luwenbin » 2009-08-23T19:43:32+00:00

Thanks, magick. The original cmyk image has a profile, so I use the command
"convert cmyk.jpg -profile USWebCoatedSWOP.icc -profile RGB.icc rgb.jpg"
and get a rgb format file which has a confortable view. But if I use the following code to generate the rgb image,
the genareated image remains cmyk format and has a unconfortable view.

Blob rgbBlob;
string strIccRGBFile = "./icc/RGB.icc";
string strIccRGBContent = LoadFile(strIccRGBFile);
rgbBlob.update(strIccRGBContent.c_str(), strIccRGBContent.length());
image.profile("ICM", rgbBlob);


the original image has a profile as below:
Profiles:
Profile-8bim: 5562 bytes
Profile-exif: 4729 bytes
Profile-iptc: 7 bytes
unknown[2,0]:
Profile-xmp: 4844 bytes

When I use command "covert", the generated image has a profile as following:
Profiles:
Profile-8bim: 5562 bytes
Profile-exif: 4729 bytes
Profile-icc: 560 bytes
Adobe RGB (1998)
Profile-iptc: 7 bytes
unknown[2,0]:
Profile-xmp: 4844 bytes

But if I use the C++ code, the generated image has another profile
Profiles:
Profile-8bim: 5562 bytes
Profile-exif: 4729 bytes
Profile-iptc: 7 bytes
unknown[2,0]:
Profile-xmp: 4844 bytes

seems that the C++ code don't work...
luwenbin
 

Re: magick++ convert CMYK to RGB

Postby magick » 2009-08-27T18:26:12+00:00

We cannot reproduce the problem with ImageMagick 6.5.5-4, the current release. Our code looks like:

Code: Select all
  try {
    {
      Image my_image;
      my_image.read("cmyk.tif");
      Blob profile = Blob((void *) AdobeRGB1998Profile, 560);
      my_image.profile("icc", profile);
      my_image.write( "rgb.tif" );Photometric Interpretation: RGB color
    }
  } catch( Exception &error_ ) {


The resulting image returns these attributes as expected:

    ...
    Photometric Interpretation: RGB color
    ...
    ICC Profile: <present>, 560 bytes
User avatar
magick
Site Admin
 
Posts: 9660
Joined: 2003-05-31T11:32:55+00:00


Return to Developers

Who is online

Users browsing this forum: No registered users and 4 guests