Hi,
I really appreciate having a quality tool like ImageMagick available, so I
hope this message can be of some help.

I've had some troubles getting it (6.3.0) to do the Right Thing with color
spaces, and have dug around a lot, so I thought I'd report my findings....

According to Exif/DCF standards, certain color spaces are implied by
reference when certain fields are filled in:

    if there's an embedded color profile,
           color space is that of the profile
    else if InteroperabilityIndex field is 'R98',
          color space is 'sRGB'
    else if InteroperabilityIndex field is 'R03',
          color space is 'Adobe RGB (1998)'
    else if ColorSpace field is '1'
          color space is 'sRGB'

Currently, if I load an Adobe RGB image from my Nikon D200 (which, like
pretty much all cameras today, indicates the color space only via the tags
as noted above), ImageMagick thinks that there is no associated color
space. Thus, when I use -profile intending to convert to sRGB, ImageMagick
takes it as an assignment of color space, rather than a conversion request.

I realize that I can
  -profile AdobeRGB.icc -profile sRGB.icc
but I think it would be better for this knowledge to be built into
ImageMagick, since that's what the EXIF fields are there for.

(Personally, I'd much rather see _assignment_ of color space be a separate
argument/function from _conversion_ to color space because it's currently
not at all clear what's happening with -profile. I had to add a bunch of
printfs to the code so I could debug what was going on. Having them be
separate also allows ImageMagick to issue an error if a conversion request
happens when the color space is unknown.)


Anyway, that's on input. When the color space is converted, the Exif data
really should be updated to reflect it:

   When the color space becomes sRGB:
        ColorSpace = 1;
        InteroperabilityIndex = 'R98';
        InteroperabilityVersion = '0100';
   plus include the sRGB profile.

   When the color space becomes Adobe RGB:
        ColorSpace = 65535;
        InteroperabilityIndex = 'R03';
        InteroperabilityVersion = '0100';
   plus include the Adobe RGB 1998 profile.

   When the color space becomes anything else:
        ColorSpace = 65535;
        delete the InteroperabilityIndex field
        delete the InteroperabilityVersion field
   plus include the appropriate ICC profile.


I could not figure out how to update the Exif fields with ImageMagick, so I
currently have to use exiftool after the fact to fix the Exif tags.

By the way, with PerlMagick, calling
   Profile(profile => '')
seemed to strip all metadata from the image, not just the icc profile.

It's rarely a good thing to strip a color profile, at least when the image
in question is a photograph (it matters less for logos and cartoons, where
the color doesn't need to be so precise).

For example, the PerlMagick function Thumbnail() does exactly what it says
it does: strips out the color profile and resizes the image, but I would
consider this to be a bug since stripping out the profile removes
information that is often necessary and may otherwise be unrecoverable.
Even if the color space is sRGB, a profile should be included to allow for
Windows getting a clue in the future, and to allow current Mac apps to show
proper colors (All current web browsers for the Mac, for example, show the
wrong colors for an unprofiled image.)

Finally, I'd like to suggest the inclusion of some Profile() examples in
PerlMagick docs. It wasn't until I read the C code that I realized that the
"name" argument should be "icc" rather than "sRGB" or the like. Oops!

       Jeffrey
--------------------------------------------------------------------------
Jeffrey Friedl           Kyoto, Japan              http://regex.info/blog/


_______________________________________________
Magick-developers mailing list
Magick-developers@imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-developers

Reply via email to