Can Exiv2 apply metadata from one image/XML file to JPEGs with different filenames?
Asked 1/6/2016
6 views
2 answers
0
I have a master JPEG that already contains metadata, plus smaller derivative JPEGs with different filenames:
Photo1.jpg— contains metadatathumb_Photo1.jpg— no metadatasample_Photo1.jpg— no metadata
I can export metadata from Photo1.jpg to Photo1.xml, but Exiv2 seems to expect sidecar/XML files to share the same basename as the target image. That means Photo1.xml applies to Photo1.jpg, but not directly to thumb_Photo1.jpg or sample_Photo1.jpg unless I duplicate/rename the XML file first.
Is there an Exiv2 option or workflow to apply metadata from a differently named XML file to other JPEGs without renaming/copying the XML each time? If not, what is the simplest way to batch-copy metadata from the master image to derivative files?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
10y ago
2 Answers
2
exiv2 seems to really prefer keeping the basenames of image files and sidecar/metadata files matched. You could automate (script) the creation/deletion of copying/renaming the metadata files like you have.
However, for what you want to do, I would strongly suggest using exiftool. It follows the unix stream paradigm much more closely. You can do what you want using exiftool with the following command:
> exiftool -TagsFromFile Photo1.jpg *_Photo1.jpg
2 image files updated
This has the benefit of not needing to create the metadata files as an interim step; it merely copies the data from Photo1.jpg into any file matching the pattern *_Photo1.jpg.
Originally by user11924. Source · Licensed CC BY-SA 4.0
user11924
10y ago
0
Generated from our catalog & community — verify before relying on it.
Yes—there is a workable Exiv2 workflow without matching basenames: pipe the XML into Exiv2 via standard input.
Example:
cat Photo1.xml | exiv2 -i - thumb_Photo1.jpg
This sends the contents of Photo1.xml to Exiv2 through stdin and inserts that metadata into thumb_Photo1.jpg. You can repeat it for other derivatives or script it for batches.
That said, based on the answers, Exiv2 generally prefers matching basenames for image/sidecar files, so scripting rename/copy/delete steps is a common workaround.
If your real goal is simply to copy metadata from the master image to multiple derivatives, exiftool is the cleaner option because it can copy tags directly from one file to others without creating XML sidecars first:
exiftool -TagsFromFile Photo1.jpg *_Photo1.jpg
That copies metadata from Photo1.jpg to matching derivative JPEGs in one step.
Recommended products
UniqueBot
AI10y ago
Your Answer
Related Questions
How can I bulk rename photos using EXIF date/time while keeping the original filename?
How can I rename photo files using the EXIF capture date?
How can I set EXIF date tags from the filename using ExifTool?
Why did my camera jump to a much higher image number, and how can I avoid duplicate filenames when importing?
How can I make a Panasonic LX5 continue file numbering from an existing SD card?