Hi there,
I'm using ExifTool 8.5 and I'm trying to append some information to the 'caption-abstract' tag using this command:
exiftool -IPTC:Caption-Abstract<$caption-abstract ${caption} -charset Latin -overwrite_original /data/images/$imageFilename
This works great for images that already have the 'caption-abstract' tag but ExifTool only gives a warning ("No writable tags") if the image does not have the 'caption-abstract' tag before I try to append something.
How can I make ExifTool to create the tag if it does not exist?
Sorry if this is a dumb question but I was unable to figure it out.
Thanks in advance!
Michael
Hi Michael,
There are 2 ways:
1) Use either -f or -m. From the application documentation:
If a specified tag does not exist, a minor warning is issued and
the line with the missing tag is not printed. However, the -f
option may be used to set the value of missing tags to '-' (but
this may be configured via the MissingTagValue API option), or the
-m option may be used to ignore minor warnings and leave the
missing values empty.
2) Assign the value to the caption-abstract in the same command, before the append:
exiftool "-caption-abstract=TEST1" "-caption-abstract<$caption-abstract TEST2" ...
In this example, the Caption-Abstract will be set to TEST1 if it doesn't already exist.
- Phil
Hi Phil,
thanks for your fast response. Unfortunately I'm still unable to get the desired result.
-f or -m does not change anything:
exiftool -f "-caption-abstract<$caption-abstract TEST2" image.jpg
still says "No writable tags found".
This command:
exiftool "-caption-abstract=TEST2" "-caption-abstract<$caption-abstract TEST2" image.jpg
sets "caption-abstract" to "TEST2" if does not exist BUT it replaces "caption-abstract" with "TEST2" if it was present instead of appending "TEST2" to the existing "caption-abstract".
Please help!
Regards,
Michael
Right. I should have suggested that you upgrade to a more recent version.
- Phil
Hi Phil,
I updated to version 9.46 but it is still not working.
This command:
exiftool "-caption-abstract=TEST2" "-caption-abstract<$caption-abstract TEST2" image.jpg
still always sets "caption-abstract" to "TEST2" regardless of the tag being present when I execute the command or not.
But I want ExifTool to set "caption-abstract" to "TEST2" if the image does not have this tag and append "TEST2" to the value of the tag if it is present.
Any other idea?
Regards,
Michael
Hi Michael,
I'm on a Mac so I use single quotes instead of double quotes:
> exiftool -ver
9.46
> exiftool -all= a.jpg
1 image files updated
> exiftool '-caption-abstract=TEST1' '-caption-abstract<$caption-abstract TEST2' a.jpg
Warning: [minor] Tag 'caption-abstract' not defined - a.jpg
Warning: No writable tags set from a.jpg
1 image files updated
> exiftool -caption-abstract a.jpg
Caption-Abstract : TEST1
> exiftool '-caption-abstract=TEST1' '-caption-abstract<$caption-abstract TEST2' a.jpg
1 image files updated
> exiftool -caption-abstract a.jpg
Caption-Abstract : TEST1 TEST2
> exiftool -caption-abstract="something else" a.jpg
1 image files updated
> exiftool '-caption-abstract=TEST1' '-caption-abstract<$caption-abstract TEST2' a.jpg
1 image files updated
> exiftool -caption-abstract a.jpg
Caption-Abstract : something else TEST2
- Phil
Phil,
I must have done something wrong yesterday: today I followed your instructions and it works now!
Thanks a lot!
Regards,
Michael