Potential bugs/enhancements related to icc profile use
Posted: 2017-03-22T22:24:03-07:00
Hi,
I'm using Perl Magick IM V7.0.5-3 Q16 x86_64.
I've been playing around with icc profiles and have come across a couple of potential bugs/enhancement requests.
I'm not sure if it's protocol here to separate out each issue (let me know if it is), but have grouped them together into this single post.
Issue 1
Converting an icc profiled RGB image to an icc profiled XYX image (using ->Profile(name=>$XYZ_profile). Works as expected. However if I further convert the resultant XYZ file to xyY (using $image->Colorspace(colorspace=>"xyY") the results are (visually) incorrect. Stripping the icc XYZ profile from the image (using $image->Profile(profile=>'');) prior to the XYZ to xyY conversion resolves the issue, so it would appear that an embedded icc profile is adversely affecting the XYZ to xyY transformation.
I'll happily provide code and the profiles I'm using if necessary.
Issue 2
When stripping out the icc profile ( $image->Profile(profile=>'');) the icc profile is properly removed, however the other icc tags embedded with the original profile (eg icc:copyright; icc:manufacturer, etc) remain in the file. Whilst this is not a significant issue, it would be much neater if the icc:* tags could be removed along with the actual profile. Alternatively is there a form of command that would effectively strip out all the icc:* tags (but RETAIN the other tags)? Although I have not verified it, my concern is that converting with a new profile which does NOT contain all the icc tags from the original profile, may result in a mix of old AND new tags if the old tags are not properly removed.
Issue 3
When using Elle Stone's nice and tidy ICC profile set (ACES & XYZ) http://ninedegreesbelow.com/photography ... files.html I'm getting very strange results when converting (with profile) from ACES to XYZ, where the resultant XYZ file has Y values of approximately half of those expected. An e-mail conversation with Elle resulted in her checking her profile with the developer at lcms. They seem confident that the profile is correct. Could it be an issue with IM?
If I take Lindbloom's "RGB16Million" file (containing all possible 16bit RGB values) and assign the ACES-elle-V4-g10 profile to the file then convert to XYZ using the XYZ-D50-Identity-elle-V4 profile, the resulting file has Y values approx 50% of the maximum.
In perl magic the commands are as follows:
Identify output of the resultant image is:
Running a round trip ACES->XYZ->ACES does correctly give input = output.
If I use the D50_XYZ profile from the icc website I do get "correct" luminance values. (I have to set colorspace to RGB to correctly use that profile).
As ever, happy to provide any further information if necessary.
Regards
Mike
I'm using Perl Magick IM V7.0.5-3 Q16 x86_64.
I've been playing around with icc profiles and have come across a couple of potential bugs/enhancement requests.
I'm not sure if it's protocol here to separate out each issue (let me know if it is), but have grouped them together into this single post.
Issue 1
Converting an icc profiled RGB image to an icc profiled XYX image (using ->Profile(name=>$XYZ_profile). Works as expected. However if I further convert the resultant XYZ file to xyY (using $image->Colorspace(colorspace=>"xyY") the results are (visually) incorrect. Stripping the icc XYZ profile from the image (using $image->Profile(profile=>'');) prior to the XYZ to xyY conversion resolves the issue, so it would appear that an embedded icc profile is adversely affecting the XYZ to xyY transformation.
I'll happily provide code and the profiles I'm using if necessary.
Issue 2
When stripping out the icc profile ( $image->Profile(profile=>'');) the icc profile is properly removed, however the other icc tags embedded with the original profile (eg icc:copyright; icc:manufacturer, etc) remain in the file. Whilst this is not a significant issue, it would be much neater if the icc:* tags could be removed along with the actual profile. Alternatively is there a form of command that would effectively strip out all the icc:* tags (but RETAIN the other tags)? Although I have not verified it, my concern is that converting with a new profile which does NOT contain all the icc tags from the original profile, may result in a mix of old AND new tags if the old tags are not properly removed.
Issue 3
When using Elle Stone's nice and tidy ICC profile set (ACES & XYZ) http://ninedegreesbelow.com/photography ... files.html I'm getting very strange results when converting (with profile) from ACES to XYZ, where the resultant XYZ file has Y values of approximately half of those expected. An e-mail conversation with Elle resulted in her checking her profile with the developer at lcms. They seem confident that the profile is correct. Could it be an issue with IM?
If I take Lindbloom's "RGB16Million" file (containing all possible 16bit RGB values) and assign the ACES-elle-V4-g10 profile to the file then convert to XYZ using the XYZ-D50-Identity-elle-V4 profile, the resulting file has Y values approx 50% of the maximum.
In perl magic the commands are as follows:
Code: Select all
$image->Profile(name=>$path."ACES-elle-V4-g10.icc"); # Apply ACES profile
$image->Set(colorspace=>"RGB");
$image->Profile(name=>$path.'XYZ-D50-Identity-elle-V4.icc'); # Convert to XYZ
$image->Set(colorspace=>"XYZ");
$image->Identify();
Code: Select all
Channel statistics:
Pixels: 16777216
Channel 0:
min: 0 (0)
max: 127.899 (0.501564)
mean: 61.4965 (0.241163)
standard deviation: 36.5982 (0.143522)
kurtosis: -1.20165
skewness: 0.00430123
entropy: 0.9943
Channel 1:
min: 0 (0)
max: 138.265 (0.542214)
mean: 63.7651 (0.250059)
standard deviation: 29.9909 (0.117611)
kurtosis: -0.808677
skewness: 0.00537519
entropy: 0.984357
Channel 2:
min: 0 (0)
max: 105.525 (0.413825)
mean: 52.5888 (0.206231)
standard deviation: 30.2774 (0.118735)
kurtosis: -1.19983
skewness: 4.67264e-05
entropy: 0.999351
If I use the D50_XYZ profile from the icc website I do get "correct" luminance values. (I have to set colorspace to RGB to correctly use that profile).
As ever, happy to provide any further information if necessary.
Regards
Mike