syntax to batch copy metadata from .jpg files to .png

Started by photoj, October 18, 2024, 06:57:12 PM

Previous topic - Next topic

photoj

Hi,

I'm on a MAC platform.

I have a set of .jpg files that I processed into png files. The sets of files are in separate folders. I need to copy the metadata (really I need just the 'content created' data) from the original jpgs to the pngs.

My best guess is: exiftool -tagsfromfile /Users/bluedot/Downloads/test/ -ext jpg -exif /Users/bluedot/Downloads/'test 2'/ -ext png

but I get the following:

Warning: No writable tags set from /Users/bluedot/Downloads/test/
    1 directories scanned
    0 image files updated
    2 image files unchanged

Thanks for any suggestions!

Best,

Jim


Phil Harvey

Hi Jim,

The command will be closer to this:

exiftool -tagsfromfile /Users/bluedot/Downloads/test/%f.jpg /Users/bluedot/Downloads/'test 2'/ -ext png "-DSTDAG<SRCTAG"

...but figuring out what DSTTAG and SRCTAG should be is still a question because I don't know what the "content created" tag would be.

Run this command on a JPG file to see what date/time tags are available:

exiftool -time:all -G1 file.jpg

Now the next question is where you want to put this information in a PNG.

I'm going out on a limb here, but maybe something like this:

exiftool -tagsfromfile /Users/bluedot/Downloads/test/%f.jpg /Users/bluedot/Downloads/'test 2'/ -ext png "-png:createdate<exififd:createdate"

or, more simply, this should work also, but will additionally write ExifIFD:CreateDate to the PNG which I'm betting that none of your other software would ever read from there.

exiftool -tagsfromfile /Users/bluedot/Downloads/test/%f.jpg /Users/bluedot/Downloads/'test 2'/ -ext png -createdate

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

wywh

macOS Sequoia 15 can read ExifIFD:DateTimeOriginal so I use that in .png. For example:

exiftool -tagsfromfile /Users/matti/Desktop/source/%f.jpg /Users/matti/Desktop/destination -ext png '-alldates<datetimeoriginal'
- Matti

Phil Harvey

Matti's command will write EXIF:DateTimeOriginal, EXIF:CreateDate, EXIF:ModifyDate, PNG:CreateDate and PNG:ModifyDate.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

photoj

Thanks for your assistance gents!

I'm getting this error: File '/Volumes/'Studio' does not exist for -tagsFromFile option. Not sure why because I'm pretty sure the paths are correct. (see below)

bds@Blues-Mac-mini ~ % exiftool -tagsfromfile /Volumes/'Studio Sync'/Sync/'BDS Library'/2024/20240-09/'FBCS 2024'/Exports/'Flagged exports'/'Head Shots'/%f.jpg /Volumes/'Studio Sync'/Sync/BDS Library/2024/20240-09/'FBCS 2024'/Exports/'Edited Extracts'/'Head Shots'/ -ext png "-png:createdate<exififd:createdate"

exiftool -tagsfromfile /Volumes/'Studio Sync'/Sync/'BDS Library'/2024/20240-09/'FBCS 2024'/Exports/'Flagged exports'/'Head Shots'/%f.jpg /Volumes/'Studio Sync'/Sync/BDS Library/2024/20240-09/'FBCS 2024'/Exports/'Edited Extracts'/'Head Shots'/-ext png '-alldates<datetimeoriginal'

Missing something I'm sure...



wywh

It might be better to drag the file to the Terminal so the path is automatically inserted and escaped if needed.

It might also be needed to set Full Disk Access to the Terminal via macOS Settings > Privacy & Security > Full Disk Access, although usually it asks it, if needed.

BTW MacOS Sequoia 15 Finder gets "Content Created" it displays from ExifIFD:DateTimeOriginal or IFD0:ModifyDate in that order from .png.

- Matti

Phil Harvey

I think the quotes are probably wrong (some special character that just looks like a quote).  Type them instead of cutting/pasting, or better yet drag and drop as Matti suggests.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

photoj

1st problem sovled!! The issue was I used Word to write the command, and it was replacing the ' with some other character. Many thanks!