Extracting and writing ICC_Profile to jpgs and pngs recursively

Started by Velo145, January 15, 2024, 02:06:19 PM

Previous topic - Next topic

Velo145

The script (MultiExport) I used in Adobe Illustrator to export jpg files does not embed sRGB IEC61966-21, which the normal Illustrator export to jpg does. So, I tried to extract the ICC profile from a regularly Illustrator-exported jpg using this:

exiftool -icc_profile -b -w icc MY.JPG
Which saved the ICC profile in the name of the image (.icc) to the same directory. I changed the name of the ICC profile in Finder to sRGB IEC61966-21.icc, and then tried to write it to a jpg without the profile with this:

exiftool "-icc_profile<=sRGB IEC61966-21.icc" MY.JPG
I got the error:

Error opening file sRGB IEC61966-2.1
Nothing to do.

So, instead of changing the ICC profile name in finder, I tried opening it in Mac ColorSync Utility, and did a "save as" to rename it from there. Same error.

What I want to do is recursively write that ICC profile to a directory (with sub-directories) of jpgs. I'd like to do the same to a directory of 24 bit png files, which I've read may or may not be possible.

Can someone help me with how to accomplish? I am already missing something, but I also am not sure how I would reference a ICC profile, let's say located on my desktop, to be written to a whole directory recursively.

Phil Harvey

Your command doesn't match up with the error message.  The error message filename is wrong, so it must have been wrong in that command too (ends with "-2.1" not "-21.icc").

Here is what I get on Mac:

> ls sRGB*
sRGB IEC61966-21.icc
> exiftool "-icc_profile<=sRGB IEC61966-21.icc" a.jpg
    1 image files updated

- 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 ($).

Velo145

Thanks for the catch Phil. So I wrote this to accomplish what else I wanted and it worked:

exiftool -r "-icc_profile<=sRGB IEC61966-2.1.icc" -overwrite_original -ext jpg -ext png /TO/MY/DIRECTORY
Wahoo.