News:

2023-08-10 - ExifTool version 12.65 released

Main Menu

Tags from Text File?

Started by ManorMan, May 20, 2018, 01:07:36 PM

Previous topic - Next topic

ManorMan

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!


ManorMan

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.

StarGeek

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

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
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StarGeek

It's going to be much slower to run exiftool in a loop like your second post.  That's Common Mistake #3.  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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

ManorMan

Yeah, that's significantly better. Thanks StarGeek.