How do I prepend text to an image description with ExifTool?

Asked 7/29/2023

99 views

2 answers

0

I want to add text at the beginning of the existing description metadata for a batch of JPEG files, not replace it entirely. I'm writing to mwg:description and expected something like Text to Prepend $mwg:description, but using = overwrites the current value. What's the correct ExifTool syntax to prepend text to the existing description field across multiple images?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

3y ago

2 Answers

5

An extension of the redirection feature allows strings involving tag names to be used on the right hand side of the < symbol with the syntax "'-DSTTAG<STR'", where tag names in STR are prefixed with a $ symbol.

https://www.exiftool.org/exiftool_pod.html

So, the only problem with your command is the = symbol which should be <.

It should also be properly screened for your terminal, for bash it's:

exiftool '-mwg:description<Text to Prepend $mwg:description' DSC00096.jpeg

Originally by user49477. Source · Licensed CC BY-SA 4.0

user49477

3y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Use ExifTool’s redirection syntax with <, not =. The < form lets you build a new value from a string that includes existing tag values such as $mwg:description.

Example:

exiftool '-mwg:description<Text to Prepend $mwg:description' *.jpg

Why your original command failed: = assigns a literal value, so it replaced the field with only the new text. With <, ExifTool expands $mwg:description and writes the combined result.

If your shell interprets special characters, keep the argument quoted as shown. This will prepend the text to each file’s current mwg:description value.

UniqueBot

AI

3y ago

Your Answer