ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: amitinddr on February 24, 2014, 06:47:12 AM

Title: Remove selective IPTC Keywords
Post by: amitinddr on February 24, 2014, 06:47:12 AM
Hey Phil
Can you help me with command to remove selective IPTC keywords? So for example if I have a set of 2000 images with 400 of them having a particular keyword "System", I would just like to remove the Keyword system so that 400 images turn without any IPTC keywords whereas remaining 1600 retain the Keywords.

PS: I am using ExifTool GUI. Direct command for that will help best please.

Thanks
Amit
Title: Re: Remove selective IPTC Keywords
Post by: Phil Harvey on February 24, 2014, 07:13:43 AM
Hi Amit,

I think this is the command you want:

exiftool -keywords-="System" DIR

where DIR is the directory containing the images.

In ExifTool GUI direct, you should leave off the "exiftool" and directory specification.

- Phil
Title: Re: Remove selective IPTC Keywords
Post by: amitinddr on February 24, 2014, 08:08:03 AM
Thanks Phil
Seems they are added in XPKeywords as well. Will this work to remove them from XPKeywords? Did not work for me :(

exiftool -XPKeywords-="System" DIR
Title: Re: Remove selective IPTC Keywords
Post by: Phil Harvey on February 24, 2014, 09:41:51 AM
No.  XPKeywords is not a list-type tag.

You must do something like this instead to edit the string value:

exiftool "-xpkeywords<${xpkeywords;s/( ,)?System( ,)?//}" ...

This removes "System" from the string, and any leading or trailing ", " delimiters.

- Phil
Title: Re: Remove selective IPTC Keywords
Post by: amitinddr on February 24, 2014, 10:14:11 AM
Phil this is not working for me. It is instead adding s/( as a new keyword.
Title: Re: Remove selective IPTC Keywords
Post by: Phil Harvey on February 24, 2014, 10:15:50 AM
What version of ExifTool are you using?  This feature was added in version 9.15.

- Phil

Edit:  Also, I got the delimiters wrong.  This is a bit trickier than I thought.  Try this:

exiftool "-xpkeywords<${xpkeywords;s/^System, //;s/, System$//;s/, System, /, /}" -xpkeywords-=System ...

This handles the keyword at the start, end, or middle of the string properly, and deletes XPKeywords if it is the only keyword.
Title: Re: Remove selective IPTC Keywords
Post by: amitinddr on February 24, 2014, 10:25:57 AM
I am using latest, 9.53
Title: Re: Remove selective IPTC Keywords
Post by: amitinddr on February 24, 2014, 10:32:09 AM
System is the only keyword. There are no other keywords for same file and I want to remove System.
Title: Re: Remove selective IPTC Keywords
Post by: Phil Harvey on February 24, 2014, 10:33:51 AM
Oh.  Then simply -xpkeywords-=System should work.

I need more details to figure out the problem.   This is what I get:

> exiftool a.jpg -xpkeywords
XP Keywords                     : System
> exiftool a.jpg -xpkeywords-=System
    1 image files updated
> exiftool a.jpg -xpkeywords
>


- Phil
Title: Re: Remove selective IPTC Keywords
Post by: amitinddr on February 24, 2014, 10:36:48 AM
Worked like a charm. Thanks :)
Title: Re: Remove selective IPTC Keywords
Post by: Phil Harvey on February 24, 2014, 10:39:30 AM
OK, so what changed?  You tried exactly this in a previous post.

- Phil
Title: Re: Remove selective IPTC Keywords
Post by: amitinddr on February 24, 2014, 10:48:00 AM
Yes, seems updating the Exiftool version helped.

Something new here - My IPTC keywords are being shown as keyword1*keyword2 whereas in XPKeywords they are shown as Keyword1;Keyword 2. Is there a way I can have them as

IPTC
Keywords: Keyword1
Keywords: Keyword2

Thanks
Amit
Title: Re: Remove selective IPTC Keywords
Post by: Phil Harvey on February 24, 2014, 11:07:30 AM
No, sorry.  But you can change the IPTC Keywords delimiter to whatever you want with the -sep option.

- Phil