ExifTool Forum

ExifTool => Newbies => Topic started by: redd on February 17, 2014, 04:35:28 PM

Title: copy icc_profile or insert one if doesn't exist
Post by: redd on February 17, 2014, 04:35:28 PM
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.
Title: Re: copy icc_profile or insert one if doesn't exist
Post by: Phil Harvey on February 17, 2014, 06:06:41 PM
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
Title: Re: copy icc_profile or insert one if doesn't exist
Post by: redd on February 18, 2014, 03:58:07 AM
Thanks for your help, it works great.
Title: Re: copy icc_profile or insert one if doesn't exist
Post by: redd on February 18, 2014, 07:24:11 AM
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.
Title: Re: copy icc_profile or insert one if doesn't exist
Post by: Phil Harvey on February 18, 2014, 07:43:20 AM
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
Title: Re: copy icc_profile or insert one if doesn't exist
Post by: redd on February 18, 2014, 08:29:30 AM
Thanks, my bad, the first command is indeed working, I was checking results on a different file.