[Originally posted by siebert on 2007-11-06 11:57:42-08]Hi,
I'm calling exiftool from a python script to write some IPTC tags with location data retrieved by reverse geocoding to my jpeg images. The script is very slow when used with lots of pictures, because for each file exiftool.exe is called (which takes some time, at least under windows).
So I'm looking for a way to set the tags for all pictures with a single exiftool invocation. By looking at the documentation I found that
exiftool "-Caption-Abstract<=%%d%%f.cap" *.jpg
would do that for one tag, but I have to create for each picture and each tag I want to set a single file, this seems not very usable to me, since creating and deleting of all these files would probably slower than my current solution.
I tried to use
exiftool -tagsfromfile %%d%%f.txt *.jpg
which would make it some better by having only one file per picture, but it seems that exiftool can't read values from plain textfiles when using tagsfromfile?
Is there another way to use at most one file per picture or, even better, one file for all pictures which provides exiftool the necessary values (and filenames of the pictures) to set the tags?
Ciao,
Steffen
[Originally posted by exiftool on 2007-11-06 12:50:12-08]Hi Steffen,
This would normally be done by writing a custom script, ie)
http://www.cpanforum.com/threads/5774http://www.cpanforum.com/threads/4609However, I'm guessing that you want to use the windows executable to
do this, which limits your options. In this case, the only text file that the
application will process is a file containing command-line arguments.
You could use the
-execute command to process a number of
files independently. ie)
exiftool -@ file.args
where
file.args contains:
-caption-abstract=caption 1
file1.jpg
-execute
-caption-abstract=caption 2
file2.jpg
-execute
-caption-abstract=caption 3
file3.jpg
I think this may allow you to do what you want.
- Phil
[Originally posted by siebert on 2007-11-06 13:33:00-08]Hi Phil,
thanks for your prompt response.
Yes, I want to use the windows executable, not a custom perl script.
The -execute option is just what I need (and obviously missed in the documentation

I already tried something like
exiftool -caption-abstract="caption 1" file1.jpg -caption-abstract="caption 2" file2.jpg
but I ended with "caption 2" written to both files.
I want to take this opportunity to thank you for this great tool. I only wish you would have used Python instead of Pearl

Ciao,
Steffen
[Originally posted by siebert on 2007-11-08 15:59:54-08]Hi,
during my first test of the batch writing I found a problem with deleting tags. My batch file looks like this:
-gps:GPSLatitude=46.808490
-gps:GPSLatitudeRef=N
-gps:GPSLongitude=71.208830
-gps:GPSLongitudeRef=W
-gps:GPSAltitudeRef=A
-GPSAltitude=5.000000
-IPTC:Country-PrimaryLocationName=Canada
-IPTC:City=Quebec
-Keywords=
-Keywords+=Canada
-Keywords+=Quebec
quebec.jpg
And I run exiftool under windows with this command:
exiftool -v0 -@ exiftoolargs.lst -common_args -overwrite_original -P -GPSMapDatum="WGS-84"
What I expect (and what worked when using the commandline instead of a batchfile) is that all existing keywords are removed and then two keywords (Canada and Quebec) are added to the file. But with the batch the deletion doesn't happen, the new keywords are just appended to the existing.
I did try some variations (-Keywords="" or a blank after -Keywords), but nothing worked.
What I'm doing wrong here?
Ciao,
Steffen
[Originally posted by exiftool on 2007-11-08 16:13:52-08]Hi Steffen,
The same thing will happen from the command line. You only use the
"+=" syntax if you want to preserve the existing keywords. To overwrite
the existing keywords, use "=" alone. ie)
-gps:GPSLatitude=46.808490
-gps:GPSLatitudeRef=N
-gps:GPSLongitude=71.208830
-gps:GPSLongitudeRef=W
-gps:GPSAltitudeRef=A
-GPSAltitude=5.000000
-IPTC:Country-PrimaryLocationName=Canada
-IPTC:City=Quebec
-Keywords=Canada
-Keywords=Quebec
quebec.jpg
- Phil
[Originally posted by siebert on 2007-11-08 16:32:49-08]Hm,
the behaviour is quite puzzling for me. I would expect that a command sequence like
exiftool -Keywords="" -Keywords+="K1" -Keywords=+="K2" file.jpg
would delete all existing keywords (first argument), then append K1 to the existing keywords (none, because just deleted), then append K2 to the existing keywords, resulting in "K1, K2" as the value of Keywords.
Why does
exiftool -Keywords="K1" -Keywords="K2" file.jpg
result in "K1, K2" instead of "K2" only? And why does
exiftool -Keywords="K1" -Keywords+="K2" file.jpg
keep the existing keywords?
I hope you can enlighten me here.
Ciao,
Steffen
[Originally posted by exiftool on 2007-11-08 17:00:22-08]Hi Steffen,
This isn't the worst of it, the following command will
also keep the existing keywords:
exiftool -Keywords="K1" -Keywords-="K2" file.jpg
It all comes down to my implementation. The "+=" and "-="
operations are special, and whenever either of them is used
on a list-type tag, then exiftool assumes that you want to
preserve all
existing values:
"+=" - add a keywords to the
existing list.
"-=" - remove a keyword from the
existing list.
It makes no sense to add/remove a keyword from the existing list
if you are going to overwrite the entire list anyway, so the
behaviour changes if a single "+=" or "-=" is used.
With just "=", the behaviour is the same with all tags: the
existing entry is replaced. Consider this command:
exiftool -keywords=K1 -keywords=K2 file.jpg
It makes no sense to replace existing keywords with K1 and
then replace K1 with K2, so I use this syntax instead to replace
the existing keywords with K1
and K2.
It may not make a lot of sense if you are thinking about the
traditional use of the "=" operator, but it should make sense
if you think about the interface and the possible combinations
of arguments.
While it is true that one might expect the following to delete
the existing keywords then add back a single keyword:
exiftool -keywords= -keywords+=lonely file.jpg # (wrong)
It doesn't, because this is accomplished by the standard function
of the "=" operator, which is to
replace the existing tag:
exiftool -keywords=lonely file.jpg # (right)
I hope this helps.
- Phil