Conditional JPG tagging with ICC colour space

Started by mcjtom, January 02, 2020, 03:24:02 AM

Previous topic - Next topic

mcjtom

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!




Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).