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!
magick++ convert CMYK to RGB
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: magick++ convert CMYK to RGB
try posting to viewforum.php?f=6
Re: magick++ convert CMYK to RGB
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.
Re: magick++ convert CMYK to RGB
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...
"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...
Re: magick++ convert CMYK to RGB
We cannot reproduce the problem with ImageMagick 6.5.5-4, the current release. Our code looks like:
The resulting image returns these attributes as expected:
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_ ) {
- ...
Photometric Interpretation: RGB color
...
ICC Profile: <present>, 560 bytes