imagemetadataexiftooliptc

Copy IPTC Core data from JPG to PNG files (with the same filename, in batch)


I like to copy...

in a folder of JPG EPS and PNG files with the same filename, from JPGs to PNGs running a command in Exiftool which would do it in batch.

Edit: The filenames contain a "." character, and sometimes a long dash "—"


Solution

  • The basic command would be
    exiftool -ext png -TagsFromFile %d%f.jpg -Title -XMP:Headline -Subject -Description /path/to/PNGS/

    You don't mention the OS, but the long dash may cause problems under Windows as CMD/PS have problems with unicode characters, at least in regards to exiftool. See exiftool FAQ #18 and this StackOverflow answer for workarounds.

    The -ext (-extension) option is used to limit processing to PNG files so you don't waste time copying the jpg data back into the jpg.

    This command will copy the XMP-dc:Title, XMP-photoshop:Headline, XMP-dc:Description, and XMP-dc:Subject tags (of which the last holds "Keywords") from the jpg file to the png file in the same directory that has the same base name. The Title and Subject tags have a preferred location in the XMP group so the names can be kept simple but since Headline can be in the IPTC IIM/Legacy group as well as XMP, it needs a leading group name to make sure it's copied to the correct location.

    To expand this command to add additional IPTC Core/Ext tags, look for the appropriate tag name on the exiftool XMP tags page, prefix the tag name with -XMP:, and add it to the command someplace after -TagsFromFile %d%f.jpg. The addition of -XMP: may not be necessary for many tags, as not all XMP tags have tags with the same name in other groups.

    There is the possibility, depending upon the app you are using to look at the data, that some of the data may show up as IPTC Core/Ext, but may be located in the IPTC IIM/Legacy or EXIF groups. This is because many apps will display data collected from the corresponding tags in other groups. The above command will not copy data from those other groups to the corresponding IPTC Core/Ext tags, as that is a more complex operation.

    This command creates backup files. Add -overwrite_original to suppress the creation of backup files. Add -r to recurse into subdirectories.

    One final detail to take note of is that metadata support in PNG files is very limited in most apps. While exiftool will copy this data correctly, your app of choice may not display it in a PNG. Windows, for example, will not show any of the above data in the Properties->Details window.