ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: jgautier on January 31, 2018, 08:46:41 AM

Title: A way to write XMP Subject from IPTC Keywords ?
Post by: jgautier on January 31, 2018, 08:46:41 AM
Hi,

I need to rewrite XMP Subject of many images, and I'd like to write on this tag what is on IPTC keywords of each image.

For ex. for the moment one image has :
- XMP Subject = "AAAA,BBB"
- IPTC Keywords = "CCC,DDD"
After modification of this image, I want :
- XMP Subject = "CCC,DDD"
- IPTC Subject = "CCC,DDD"

And I need to do that for more than 300 000 images (with différent tags).

Is there a way that you suggest to do that ?

Thanks a lot for your help.

J. Gautier
Title: Re: A way to write XMP Subject from IPTC Keywords ?
Post by: Phil Harvey on January 31, 2018, 09:05:49 AM
To set XMP:Subject from the value of IPTC:Keywords, the command is:

exiftool "-XMP:Subject<IPTC:Keywords" DIR

I think this is what you want to do.

- Phil
Title: Re: A way to write XMP Subject from IPTC Keywords ?
Post by: jgautier on January 31, 2018, 09:21:06 AM
Thanks a lot Phil.

One question :
Suppose this command stops (for a reason or another) before the end.
If I execute it again , will it start again from the beginning and write again all files ?

JG
Title: Re: A way to write XMP Subject from IPTC Keywords ?
Post by: Phil Harvey on January 31, 2018, 09:23:31 AM
Yes.  To avoid rewriting files unnecessarily, you could add this to the command:

-if "$IPTC:Keywords and (not $XMP:Subject or $XMP:Subject ne $IPTC:Keywords)"

- Phil
Title: Re: A way to write XMP Subject from IPTC Keywords ?
Post by: jgautier on January 31, 2018, 09:25:29 AM
Ok, thanks.
JG
Title: Re: A way to write XMP Subject from IPTC Keywords ?
Post by: jgautier on January 31, 2018, 10:10:25 AM
Sorry, but when I try the command It failed to recognize images that have different XMP:Subjet and IPTC:Keywords.

I put some images in a folder (called "hidef_test"), and type this command :
exiftool -if "$IPTC:Keywords and (not $XMP:Subject or $XMP:Subject ne $IPTC:Keywords)" "-XMP:Subject<IPTC:Keywords" hidef_test

But the command returns :
1 directories scanned
26 files failed condition
0 image files read

Can you understand why ?

JG
Title: Re: A way to write XMP Subject from IPTC Keywords ?
Post by: Phil Harvey on January 31, 2018, 10:12:35 AM
Read my signature.  Are you on Mac or Linux?
Title: Re: A way to write XMP Subject from IPTC Keywords ?
Post by: jgautier on January 31, 2018, 10:15:22 AM
Oh yes, you're right (I'm on linux) : sorry for my mistake.

JG