Exiftool -tagsfromfiles copy metadata from one file to another

Started by Allison.nussbaum, November 07, 2022, 02:16:45 PM

Previous topic - Next topic

Allison.nussbaum

I'm trying to copy the metadata from one image to another using the exiftool in Python but am having some trouble.

I'm using GDAL to compress the file (works properly) and then exiftool to copy the data over using the following code:

cmd='gdal_translate -co quality=3 -of JP2OpenJPEG "G-LiHT (6)_rgbi.jp2" "G-LiHT (6)_rgbi_comp3.jp2"'
os.system(cmd)
cmd2='exiftool -tagsfromfile "G-LiHT (6)_rgbi.jp2" -overwrite_original -ext "G-LiHT (6)_rgbi_comp3.jp2" .'
os.system(cmd2)

Is there something I'm missing here? The output in terminal is:
    1 directories scanned
    0 image files read

Thanks in advance!

StarGeek

You should try running the command in Terminal first to make sure the command does what you want.

I can't help with the python stuff but one error I see is that you have the -ext (-extension) option without actually listing an extension. This option requires a second parameter. The result is that you're passing an extension of "G-LiHT (6)_rgbi_comp3.jp2"

There is a Python wrapper for exiftool called PyExifTool.  You might look into that as I believe it uses the -stay_open option which can speed commands up and avoid Common Mistake #3.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype