ExifTool Forum

ExifTool => Newbies => Topic started by: mcjtom on January 02, 2020, 03:24:02 AM

Title: Conditional JPG tagging with ICC colour space
Post by: mcjtom on January 02, 2020, 03:24:02 AM
My camera (and most others, I understand) can produce JPGs internally with either sRGB or AdobeRGB1998 ICC colour space.  Those files do not have ICC profiles attached to them, but are tagged with two (I think) EXIF tags indicating which gamut they represent:

EXIF:InteropIndex="R03" or "R98"
EXIF:ColorSpace="0x1" for sRGB and "uncalibrated" for anything else, most often AdobeRGB?

There is an -if command in ExifTool, so I was hoping to automatically attach the appropriate ICC profile to the JPG files off the camera based on the EXIF tag/tags that the camera has written to the file.

Could I get some pointers on how to go about it?  For example, is it enough to use one of these EXIF tags above, or do I need both? Which tag would be more universal among manufacturers?

Thanks!



Title: Re: Conditional JPG tagging with ICC colour space
Post by: Phil Harvey on January 02, 2020, 07:45:06 AM
I don't know the best way to deduce the color space from the EXIF, but to do what you want you would use two commands, something like this:

exiftool -if "not $icc_profile and $EXIF:ColorSpace eq 'sRGB'" "-icc_profile<=MY_SRGB_PROFILE.icc" FILE

exiftool -if "not $icc_profile and $EXIF:ColorSpace ne 'sRGB'" "-icc_profile<=MY_ADOBERGB_PROFILE.icc" FILE


- Phil