Page 1 of 1

Color profile handling regression from 6.8.6-10 to 6.8.7-10

Posted: 2014-01-15T22:49:07-07:00
by eefi
I've found what seems to be a regression in handling of embedded color profiles in JPEGs between 6.8.6-10 and 6.8.7-10.

I took the test Landscape_2.jpg image from https://github.com/recurser/exif-orientation-examples and attempted to normalize it to sRGB colorspace by running

Code: Select all

convert Landscape_2.jpg -colorspace sRGB Landscape_2-out.jpg
6.8.6-10 resulted in an image that looks the same, but 6.8.7-10 resulted in an image that looks noticeably darker. I've uploaded the original and the output from the two versions at http://imgur.com/a/vF0nC.

This effect can be most easily seen by flipping between the three images in quick succession: This regression also affects 6.8.8-2.

The reason I'm trying to get to the bottom of this is that we're working on building a "normalize image for web" service using ImageMagick, and one of the desired steps is to convert any image that comes in from whatever its source colorspace is to sRGB.

Edited Thu Jan 16 01:24:17 EST 2014: It looks like imgur doesn't actually serve the original files uploaded, though the effect looks the same. I am happy to send the files I have to anyone who can't reproduce themselves. Also, I'm running on Debian GNU/Linux sid.

Re: Color profile handling regression from 6.8.6-10 to 6.8.7

Posted: 2014-01-15T23:36:40-07:00
by fmw42
Your input image has a color profile which is a linear RGB profile and not sRGB.

Profile-icc: 1960 bytes
Description: Generic RGB Profile
Manufacturer: Generic RGB Profile
Model: Generic RGB Profile

But IM does not know that and thinks the image is sRGB (according to the -verbose information). So it is possible that different versions of IM interpreted the image color differently. There has been much change in IM over time to improve colorspace issues. I do not know if this is a bug or not.

To handle colorspace properly, you should use profiles to convert to sRGB for more accurate color handling.

The following command does not produce a darker result.

Code: Select all

convert WNrvE31.jpg -profile /Users/fred/images/Profiles/GenericRGBProfile.icc -profile /Users/fred/images/Profiles/sRGB.icc test.jpg
You will need to use the path to where you have your profiles.

Re: Color profile handling regression from 6.8.6-10 to 6.8.7

Posted: 2014-01-16T02:08:31-07:00
by eefi
Ah, thanks for the clarification, fmw42. It looks like I had a fundamental misunderstanding of what the -colorspace option does. In fact, the thing I wanted to do was use -profile with a downloaded copy of an sRGB ICC profile.

For future readers, what I did was download the "PC version" of the sRGB ICC profile from http://web.archive.org/web/200206031539 ... gsrgb.html. Though its file extension is .exe, it's just a self-extracting .zip file, and any standard unzipper will open it. Save "sRGB Color Space Profile.icm" somewhere.

Then all I had to do was

Code: Select all

convert Landscape_2.jpg -profile "path/to/sRGB Color Space Profile.icm" out.jpg
and I got an out.jpg that had color values in the standard sRGB IEC61966-2.1 space with the profile embedded in the file.

Re: Color profile handling regression from 6.8.6-10 to 6.8.7

Posted: 2014-01-16T11:25:44-07:00
by fmw42
I believe that sRGB and a number of other color profiles come with IM.

If not then it can be obtained with http://www.color.org/srgbprofiles.xalter