ExifTool Forum

ExifTool => Newbies => Topic started by: ManorMan on May 20, 2018, 01:07:36 PM

Title: Tags from Text File?
Post by: ManorMan on May 20, 2018, 01:07:36 PM
What I'm trying to achieve is the following

exiftool -tagsFromFile tagsfile.txt image.jpg

TAGSFILE.TXT
XPTitle="Title here"
XPSubject="Subject here"
XPComment="Comments here"

I'm aware -tagsFromFile is from pulling existing tags from an image. Is there a way I haven't found to apply specific tags to an image from a text file?

Help massively appreciated!

Title: Re: Tags from Text File?
Post by: ManorMan on May 20, 2018, 02:36:04 PM
While I'm not sure its possible within ExifTool, I've found the following line in a batch file works for anyone struggling with the same issue

for /F "tokens=*" %%A in (tagsfile.txt) do exiftool.exe %%A image.jpg

tagfile.txt is the same structure as in OP.
Title: Re: Tags from Text File?
Post by: StarGeek on May 20, 2018, 02:38:06 PM
You can't user -TagsFromFile to pull tags from a text file, but you can the text file to directly write the tags using the -@ option (https://exiftool.org/exiftool_pod.html#ARGFILE). 

Just change your text file so that it has the actual commands, one per line, without the quotes, like this:
-XPTitle=Title here
-XPSubject=Subject here
-XPComment=Comments here


and then call it with a command like this:
exiftool -@ /path/to/TAGSFILE.TXT FileOrDir
Title: Re: Tags from Text File?
Post by: StarGeek on May 20, 2018, 02:41:13 PM
It's going to be much slower to run exiftool in a loop like your second post.  That's Common Mistake #3 (https://exiftool.org/mistakes.html#M3).  The startup time is exiftool's biggest performance hit and if you run it individually on hundreds or thousands of files, it'll take much longer than running it once like my example.
Title: Re: Tags from Text File?
Post by: ManorMan on May 20, 2018, 03:11:03 PM
Yeah, that's significantly better. Thanks StarGeek.