copy icc_profile or insert one if doesn't exist

Started by redd, February 17, 2014, 04:35:28 PM

Previous topic - Next topic

redd

Hi,
I'm trying to run a command line to copy all metas & icc_profile from file1 to file2,
and inserting a default *.icc if file1 doesn't have one.

So far, this is what I've got:

exiftool -overwrite_original -TagsFromFile file1 -all:all "-icc_profile-<= -icc_profile<=sRGB_IEC61966-2-1.icc" file2

But this isn't working.

Would you have an idea ?

Thanks.

Phil Harvey

This should do what you want:

exiftool "-icc_profile<=sRGB_IEC61966-2-1.icc" -tagsfromfile file1 -all:all -icc_profile file2

Since ICC_Profile is protected, you must specify it explicitly when copying.  If it exists in file1, then it will override the earlier assignment.

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

redd


redd

#3
And just out of curiosity, how would do with a single file, to add a default profile if none exists, I tried :

exiftool "-icc_profile<=sRGB_IEC61966-2-1.icc" -if "not $profiledescription" file

or like the previous one with tagsfromfile, but within the same file

exiftool "-icc_profile<=sRGB_IEC61966-2-1.icc" -tagsfromfile file -all:all -icc_profile file

With no success.

Phil Harvey

Your first command should work (if you are on Windows, because the quoting would be wrong for Mac/Linux), however I would suggest testing $ICC_Profile:all instead of $profileDescription just in case the description is empty.

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

redd

Thanks, my bad, the first command is indeed working, I was checking results on a different file.