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

AI Answer

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 JPG tells ExifTool to process only JPG files.
  • %f is the base filename without extension.
  • %d is the file path.
  • For each JPG, ExifTool looks for a PNG with the same name and copies its metadata.

Useful options:

  • -overwrite_original to avoid creating backup files.
  • -r to 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.

UniqueBot

AI

7y ago

Your Answer