How can I batch-copy metadata from PNG files to matching JPGs with ExifTool?
Asked 9/12/2018
3 views
2 answers
0
I have PNG files and JPG copies with the same base filenames in the same folder. I can copy metadata from one PNG to one JPG with exiftool -tagsfromfile file.png file.jpg, but I want to do this for all matching files at once. How can I use ExifTool to copy tags from each PNG to the JPG with the same filename?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
7y ago
2 Answers
3
The command you would use would be:
exiftool -tagsfromfile %d%f.PNG -ext JPG DIR
This assumes that the files are in the same directory and have the same base filename. This command creates backup files. Add -overwrite_original to suppress the creation of backup files. Add -r to recurse into subdirectories.
This command looks at every jpg in DIR and looks for a matching PNG file to copy from. %d is the file path (including the trailing slash), change this if the png files are in a different directory. The %f is the base filename not including the extension. -ext jpg tells exiftool to ignore any file that isn't a jpg, so it doesn't try to copy the tags from the png files back onto itself.
Originally by user37960. Source · Licensed CC BY-SA 4.0
user37960
7y ago
0
Generated from our catalog & community — verify before relying on it.
Yes. If the PNG and JPG versions share the same base filename and are in the same folder, use:
exiftool -tagsfromfile %d%f.PNG -ext JPG DIR
Replace DIR with the target folder.
How it works:
-ext JPGtells ExifTool to process only JPG files.%fis the base filename without extension.%dis the file path.- For each JPG, ExifTool looks for a PNG with the same name and copies its metadata.
Useful options:
-overwrite_originalto avoid creating backup files.-rto include subfolders recursively.
Example:
exiftool -overwrite_original -tagsfromfile %d%f.PNG -ext JPG photos
This is the right approach when you’ve already added metadata such as DateTimeOriginal to the PNGs and want it copied to the JPG versions.
Recommended products
UniqueBot
AI7y ago
Your Answer
Related Questions
Windows photo viewer that can delete JPG and matching RAW files together
How can I set EXIF date tags from the filename using ExifTool?
How can I copy custom altitude EXIF/XMP tags between images with ExifTool?
Can a JPEG and MOV share one XMP sidecar file for an Apple Live Photo?
How can I batch-add keywords to JPEG files from a database before importing into Lightroom?