Search code examples
exiftool

How to use Exiftool to copy jpg metadata to RAW file after exporting from Lightroom


Using Lightroom, I made adjustments to some jpg files (primarily to the toning), as well as added some IPTC data. I saved the metadata to those files and also exported them.

Now I would like to copy just the IPTC and edit adjustments from either the sorce jpgs or the exported jpgs into their corresponding RAW files, but I'm not sure of the syntax or tags to specify.

This is my folder structure:

.\Working
.\Working\RAW_Source\
.\Working\JPG_Source\
.\Working\JPG_Exports\

Notes:

  1. all file names are the same except for their extensions.
  2. there are no sidecar files involved. Metadata needs to exist ONLY in the jpg or RAW files.

Thanks


Solution

  • Assuming that the files have the same base name, your basic command would be along these lines.
    To copy from JPG_Source to RAW_Source
    exiftool -TagsFromFile .\Working\JPG_Source\%f.jpg -xmp:all -iptc:all .\Working\RAW_Source\

    To copy from JPG_Exports to RAW_Source
    exiftool -TagsFromFile .\Working\JPG_Exports\%f.jpg -xmp:all -iptc:all .\Working\RAW_Source\

    To copy tags from either source (latter DIR has priority)
    exiftool -TagsFromFile .\Working\JPG_Exports\%f.jpg -xmp:all -iptc:all -TagsFromFile .\Working\JPG_Source\%f.jpg -xmp:all -iptc:all .\Working\RAW_Source\

    That will copy all XMP tags (which includes IPTC Core) and IPTC IIM/Legacy tags to the RAW files.

    These commands would create backup files which can be suppressed with the -Overwrite_Original option. You can recurse into subdirectories with the -r (recurse) option.

    These commands do not include any GPS tags or EXIF tags. You can add the GPS tags by adding -GPS:All to the command. It's usually not a good idea to edit tags in the EXIF group in RAW files unless you know exactly what you are doing, as it can cause the RAW file to become unviewable, as some of these tags are needed to tell software how to render the image (see ExifTool FAQ #8).

    Also take note that these command write the data directly into the RAW file. If you wish to write the data into an XMP sidecar file, the command would be more complex, depending upon whether the XMP sidecar files already exists or not. If the sidecar files already exist, then you would add -ext XMP to the above commands.