News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Transferring exif data from one JPG to another

Started by monkeyisland, May 18, 2013, 04:27:35 PM

Previous topic - Next topic

monkeyisland

Hi, I'm about as noob as you can get. I don't understand terminal commands, and I'm frustrated with Photoshop CS5. Here's my process:

I download a client's JPG that has EXIF and TIFF camera info that I can read on my Mac program, "Preview". But when opening the file in Photoshop, I get a warning that some data cannot be read and is ignored.

I work on the image, update the metadata that hasn't been affected (but there's not camera data), and save it as a JPG.

I'd downloaded the "Save with EXIF".jsx script for Photoshop that uses Phil's ExifTool command program and is supposed to work; but it doesn't unfortunately.

So I'm wondering two things:

1. How can I transfer EXIF data from the original jpg file to the edited JPG file, without destroying any other metadata

2. Is this done without affecting the JPG image itself?

Thanks so much for any help. If anyone wants to be super helpful and give me direct (and trustworthy) terminal commands, both files will be on my desktop and titled "Flattened Original.jpg" (with exif data) and "Flattened Final.jpg" (edited).

I'll check back in. Thanks!

Phil Harvey

Quote from: monkeyisland on May 18, 2013, 04:27:35 PM
1. How can I transfer EXIF data from the original jpg file to the edited JPG file, without destroying any other metadata

This is tricky, but a command like this would do it:

exiftool -wm cg -tagsfromfile "Flattened Original.jpg" -all:all "Flattened Final.jpg"

(before running this command you should change directory to your Desktop.  I'm not sure exactly where this is in the Windows directory system, but on a Mac you do this with cd Desktop.  But instead of cd-ing to the Desktop you can drag and drop the images into the command window instead of typing their names when you want enter that part of the command.)

The -wm cg was the tricky part.  This causes exiftool to only create tags that don't already exist, and allows you to accomplish your goal of not destroying existing metadata.

Quote2. Is this done without affecting the JPG image itself?

Yes.

- 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 ($).

monkeyisland

#2
Phil, what a pleasure to be helped out by you. This worked brilliantly. I'm glad I mentioned desktop; I went ahead and moved the files into my Documents folder, dragged/dropped them onto terminal (didn't know you could do that), and exiftool did its thing, creating a new file/same name and saving the original image with an _original added to its name. Took me only a minute to sort through everything and check the exif tags.

Here's the interesting part. The original image has "Creator Tool   Microsoft Pro Photo Tools" in its metadata and Photoshop CS5 wouldn't read it and ignored this EXIF information. I use your exiftool command line you kindly provided for me, and the new image with the exif data transferred into it *can* be read by Photoshop. Perhaps an incompatibility somewhere, but I'm very happy to see it's not persistent. I mention it only because it may be of interest to you on some level.

I'll bookmark this thread, and copy your cmd line in several areas because I'm bound to never find it again when I need it lol. Thank you!


Edit: I will add a minor error that I forgot to mention. After the EXIF transfer is complete, Terminal reports back:

Warning: [minor] Possibly incorrect maker notes offsets (fix by 4320?) - /Users/monkeyisland/Documents/Flattened Original.jpg
    1 image files updated

The EXIF data seems to be complete, I still have to do a more thorough check, but at least the vitals are there (camera, lens, exposure, shutter, etc), but it does affect the "Origin" metadata (this is what the tab is called in Photoshop, not sure who or what specific piece of metadata this belongs to), by cutting off either the "Source" URL or the "Credit" line if there are too many characters. Still, Photoshop is able to open the file, read the EXIF data, I can easily correct both source and credit lines and save, close, reopen, and the metadata will all be correct. Again, just bringing it to your attention, but I'm very happy I can keep camera info now!

Phil Harvey

Quote from: monkeyisland on May 18, 2013, 09:52:02 PM
The original image has "Creator Tool   Microsoft Pro Photo Tools" in its metadata and Photoshop CS5 wouldn't read it and ignored this EXIF information. I use your exiftool command line you kindly provided for me, and the new image with the exif data transferred into it *can* be read by Photoshop.

If you saw any warnings when ExifTool ran, it could be that ExifTool found some problems and fixed them.  I have seen similar things in the past where Photoshop is picky about something.

QuoteEdit: I will add a minor error that I forgot to mention. After the EXIF transfer is complete, Terminal reports back:

Warning: [minor] Possibly incorrect maker notes offsets (fix by 4320?) - /Users/monkeyisland/Documents/Flattened Original.jpg
    1 image files updated

This won't cause a problem with Photoshop, but you may lose some MakerNote information if this isn't handled properly.  You might run your command again (on the original files) using the -F option and compare the result to see if anything changed. See FAQ 15 for more information about this.

- 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 ($).