ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: lokatz on May 27, 2022, 12:15:33 PM

Title: Strange effects when writing keywords
Post by: lokatz on May 27, 2022, 12:15:33 PM
Have been using ExifTool now for quite a while in my (large) software project, but I'm still merely a novice user rather than an expert. After I mostly used it for reading metadata, previews, etc.,  I am currently implementing a routine to modify and write back keywords.  This is where I see two rather strange effects, though I THINK I am doing what the documentation, in particular FAQ #17, tells me to do.

An arbitrary example, straight from the args.txt file:

[filename]
-overwrite_original
-sep
", "
-IPTC:Keywords="Unsaturated, Architecture, Building, Tower, Window, Wall, House, Ruin, ABC"
-IPTCDigest=new
-XMP-dc:Subject="Unsaturated, Architecture, Building, Tower, Window, Wall, House, Ruin, ABC"
-XMP-lr:HierarchicalSubject="Architecture, Architecture|Ruin, Architecture|Ruin|ABC"
-execute


What happens are two things:  ExifTool gives me a "Warning: [Minor] IPTC:Keywords exceeds length limit (truncated)", plus the image file receives these keywords WITH the surrounding quotation marks, which looks as if the -sep command has been ignored. This is with ExifTool 12.40 on a Windows system. 

Any idea what may be causing this?
Title: Re: Strange effects when writing keywords
Post by: Phil Harvey on May 27, 2022, 01:08:19 PM
Quotation marks are not used around arguments in a -@ argfile (see the -@ option documentation).  The quotation marks are only part of the command shell syntax, and not handled by ExifTool.

- Phil
Title: Re: Strange effects when writing keywords
Post by: lokatz on May 27, 2022, 02:05:20 PM
I sensed there was something I was overlooking.  Thank a lot, Phil!

EDIT:  Even after dropping the quotation marks, I still get the "exceeds length limit (truncated)" warning with the same example as above.  Checking several example images, it appears to happen whenever the total chain of keywords is more than about 60 characters (or more than ~7-8 entries?) long.  Is there an IPTC limit of some kind that I may be unaware of?
Title: Re: Strange effects when writing keywords
Post by: Phil Harvey on May 27, 2022, 03:31:44 PM
There is a limit on the individual keywords, so if you are hitting the limit then your keywords aren't being split properly.  Did you also remove the quotes from the -sep argument?

- Phil
Title: Re: Strange effects when writing keywords
Post by: lokatz on May 27, 2022, 03:40:13 PM
Well, I guess you already knew the answer.   :-\    I did NOW, and that fixes it.  Thanks!  (Only excuse:  I'm not exactly at home in a command line environment...)
Title: Re: Strange effects when writing keywords
Post by: StarGeek on May 27, 2022, 05:41:41 PM
Links to the appropriate parts of the docs
-@ (Argfile) option (https://exiftool.org/exiftool_pod.html#ARGFILE)
FAQ #29 (https://exiftool.org/faq.html#Q29)