Page 1 of 1

no ICC profile conversion perfrmd - Magick::Image::profile()

Posted: 2011-02-06T11:36:56-07:00
by whatdoido
Hi,

I am using the C++ API - I have a aRGB jpg loaded into memory and construct a Image object and wish to perform a ICC color profile conversion.

Code: Select all

        Magick::Image  magick(argv[1]);

        uchar_t*  profile = NULL;
        size_t  profile_length = 0;

        // alloc buf space for profile and read target ICC profile from disk
        ...

        magick.profile("ICM", Magick::Blob(profile, profile_length) );
        magick.quality(100);
        magick.write("converted.jpg");
However, when I view the converted.jpg image, there is no conversion. It looks exactly the same as the original aRGB image. Using exiftool, I also see no reference to the expected target (sRGB) profile.

When I use the convert util

Code: Select all

convert -profile NKAdobe.icm aRGB.jpg -profile NKsRGB.icm sRGB.jpg
the converted image (sRGB.jpg in this case) has clearly had the conversion applied.

I can see that Magick::Image::profile() simply calls ProfileImage(), whose comments in profile.c state that
ProfileImage() associates, applies, or removes an ICM, IPTC, or generic profile with / to / from an image. If the profile is NULL, it is removed
Am I mis-using the API? Additionally, how would I specify which rendering intent (for example, perceptual) to use during the conversion?

thanks in advance

Re: no ICC profile conversion perfrmd - Magick::Image::profi

Posted: 2011-02-06T11:46:06-07:00
by magick
Profile transformations requires two color profiles, a source and destination. If you apply one color profile. its associated with the image but no color transformation is applied.

Re: no ICC profile conversion perfrmd - Magick::Image::profi

Posted: 2011-02-06T12:13:52-07:00
by whatdoido
Thanks. So to clarify, I would need to call Image::profile(..) twice: one to set the ICC profile of the image pre-conversion and then again with the target ICC profile and at this point the conversion will be applied?

How would one specify the rendering intent?

Re: no ICC profile conversion perfrmd - Magick::Image::profi

Posted: 2011-02-06T13:17:46-07:00
by magick
Correct. Use renderingIntent() to specify the rendering intent. Choose from SaturationIntent, PerceptualIntent, AbsoluteIntent, and RelativeIntent.

Re: no ICC profile conversion perfrmd - Magick::Image::profi

Posted: 2011-02-06T15:56:28-07:00
by whatdoido
Thanks. I am still having trouble with this. I have a very simple test program

Code: Select all

	Magick::Image  magick("adobe.jpg");

	magick.renderingIntent(Magick::PerceptualIntent);

	magick.profile("ICM", Magick::Blob(aRGB, aRGBsz));

	const Magick::Blob  targetICC(sRGB, sRGBsz);
	magick.profile("ICM", targetICC);
	magick.iccColorProfile(targetICC);

	magick.write("srgb.jpg");
This is what was discussed. It opens a file that is in Adobe RGB and does the conversion.

However, when compared against the output from the 'convert' util, the image from the sample program is noticably different. The program's output looks exactly like the original. I am a little lost. Any thoughts?

thanks in advance.


The following files are available - these are the files I've been using to demonstrate my problem:

sample program; https://sites.google.com/site/devdump12 ... ects=0&d=1

original aRGB image: https://sites.google.com/site/devdump12 ... edirects=0
sample program ICC converted image: https://sites.google.com/site/devdump12 ... edirects=0

convert utli output: https://sites.google.com/site/devdump12 ... edirects=0

input (Nikon) aRGB profile: https://sites.google.com/site/devdump12 ... ects=0&d=1
output (Nikon) sRGB profile: https://sites.google.com/site/devdump12 ... ects=0&d=1

Re: no ICC profile conversion perfrmd - Magick::Image::profi

Posted: 2011-02-06T16:02:53-07:00
by whatdoido
Actually, forget that. I've just replaced references to "ICM" to "ICC" and that's worked!!

What are the differences between ICM and ICC when specifying this to the Image::profile(..) method?