Copy data from JPG to RAW?

Started by neil40, January 26, 2017, 06:03:10 AM

Previous topic - Next topic

neil40

#15
Quote from: Phil Harvey on January 26, 2017, 09:58:41 PM
NO.  Don't do that!

Be careful what you copy to a RAW file.  It is not advisable to change any of the maker notes because they may contain information necessary for proper rendering of the image (WhiteBalance for example).

Something like -xmp:all and -iptc:all would be more reasonable.

- Phil
OK, so I tried exiftool -tagsfromfile %-:1d%f.jpg -gps:all -xmp:all -iptc:all -ext raf "E:\New England 2\2016-10-24\RAF Files" and it only wrote the GPS data to the RAF files. Do I need to do 3 separate passes?

I'm also curious at the datestamps given to the modified RAF files, which all seem to be 26/1/2017 22:00 when I ran this at about 10:00 on 27/1/2017!
Not a huge issue, but surprised.

[Edit] Curious, I just ran the exiftool -a -G1 -s FILE command on a single file I ran the exiftool -tagsfromfile %-:1d%f.jpg -gps:all -xmp:all -iptc:all -ext raf command on and find that this reports the XMP and IPTC tags are there.
Perhaps it's a problem with Geosetter as it still doesn't show them!

Phil Harvey

Quote from: neil40 on January 27, 2017, 10:53:40 AM
OK, so I tried exiftool -tagsfromfile %-:1d%f.jpg -gps:all -xmp:all -iptc:all -ext raf "E:\New England 2\2016-10-24\RAF Files" and it only wrote the GPS data to the RAF files. Do I need to do 3 separate passes?

No.  It should do it in one pass.

Quote[Edit] Curious, I just ran the exiftool -a -G1 -s FILE command on a single file I ran the exiftool -tagsfromfile %-:1d%f.jpg -gps:all -xmp:all -iptc:all -ext raf command on and find that this reports the XMP and IPTC tags are there.
Perhaps it's a problem with Geosetter as it still doesn't show them!

Perhaps.  I think Geosetter uses its own routines for reading.

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

StarGeek

Quote from: neil40 on January 27, 2017, 10:53:40 AM
Perhaps it's a problem with Geosetter as it still doesn't show them!

Hit F5 or Images menu -> Refresh and it should show the new data.
"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

neil40

Quote from: StarGeek on January 27, 2017, 01:31:28 PM
Quote from: neil40 on January 27, 2017, 10:53:40 AM
Perhaps it's a problem with Geosetter as it still doesn't show them!

Hit F5 or Images menu -> Refresh and it should show the new data.
It's odd, I've done a refresh but although the Geosetter Info panel shows identical info for JPG and RAF files, on the Thumbnail view it doesn't show the Location in the RAF files
Attached some screenshots, I know it's not really 'topic' though.

neil40

Interesting to note that in Geosetter, if I 'Get from Web' the locations, it fills them in as per the JPG, but then creates a .xmp file when I save the changes.
Copying the data from JPG to RAF using exiftool in a command shell, doesn't create such a file (xmp)

What is the difference in what's happening in each process?
Thanks

StarGeek

Check the File menu->Settings->File Options tag

I think the default is to create xmp files for RAF.

Geosetter has a lot of options on how to save the data and does a lot of processing of the locations and time stamps to get everything correct.

To see what the exact command Geosetter is using, go to Images menu->Show Save Report.
"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

neil40

Quote from: StarGeek on January 29, 2017, 08:04:39 PM
Check the File menu->Settings->File Options tag

I think the default is to create xmp files for RAF.

Geosetter has a lot of options on how to save the data and does a lot of processing of the locations and time stamps to get everything correct.

To see what the exact command Geosetter is using, go to Images menu->Show Save Report.
Thanks for this. As I am using the command exiftool -tagsfromfile %-:1d%f.jpg -gps:all -xmp:all -iptc:all -ext raf "E:\New England 2\2016-10-24\RAF Files" to copy data from the JPG to the RAF files, can I include an option to write a xmp file for each file, such that the information is then visible in Geosetter?

Thanks again

Phil Harvey

Hi Neil,

Assuming you want to write the XMP file to the same directory as the RAF image, this will do it:

exiftool -tagsfromfile %-:1d%f.jpg -srcfile %d%f.xmp -xmp:all -ext raf "E:\New England 2\2016-10-24\RAF Files"

(yes, ExifTool can do just about anything) ;)

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

neil40

Quote from: Phil Harvey on February 01, 2017, 08:58:44 AM
Hi Neil,

Assuming you want to write the XMP file to the same directory as the RAF image, this will do it:

exiftool -tagsfromfile %-:1d%f.jpg -srcfile %d%f.xmp -xmp:all -ext raf "E:\New England 2\2016-10-24\RAF Files"

(yes, ExifTool can do just about anything) ;)

- Phil
Phil,

Fabulous, that's perfect. I now see the RAF file location data in Geosetter as per the JPG versions.
Indeed, exiftool can do most anything!

Thanks once again.
Neil

msandersen

Thanks, this is just what I needed.
In my use case, I used a Geotagging app on my phone called Geotag Photos 2 while out taking photos, it displays the time with seconds on the start screen which I take a photo of with my camera for reference, then start my log. After I'm done, it uploads the log, and later on my computer the Desktop version downloads the log and tags my photos. But before I do, I import with Photo Mechanic, apply a template and add keywords, and adjust the CreateDate time of all the photos based on my reference photo with the time stamp, so the GPS log will sync correctly.
Now, while all this works as it should and looks fine in Photo Mechanic (showing jpg and raf files in a unified dialog), I noticed a couple of things while looking at the files with Exiftool. I shoot both jpg and raf files, and using Photo Mechanic to change metadata, only the jpg was changed, the raf file was unchanged while all the added metadata and the changed CreateDate was written to the accompanying xmp file. But in the jpg file, only xmp:CreateDate was changed, exif:CreateDate was not. Which might not be a problem as long as all apps read the xmp value; in this case, not so important as the time was only out by a minute and a bit, I just needed to sync the log.
But I also found malformed GPS data in some XMP and Raf files (indicating it was shot in the middle of the ocean at 0 deg and 11m underwater for example), not sure if that was from the Geotag Photos app. The Jpgs were fine.
For the sake of archiving and retaining all metadata in the raf file even if separated from the xmp and jpgs which are superseded by processed raf files anyway, I wanted to write the jpg metadata to the raf files.
Thankfully, I found this thread which gave me the answer.

The command I've gone with is
exiftool -tagsfromfile %d%f.jpg -gps:all -xmp:all -iptc:all --iptc:Category '-xmp:CreateDate>exif:CreateDate' -overwrite_original -ext raf /directory/path
where the jpg and raf files are in the same directory.

I'm gonna have to examine some of my older files for similar issues where I might have used the Geotagging app, and whether it is different with my Canon cr2 files.
Which leaves one question: For some of the folders, I have camera jpgs and rafs in 2 different folders, and was wondering about the syntax.
/raf
/jpg
What would be the syntax for reading from the jpg directory and writing to the raf directory?

StarGeek

Quote from: msandersen on August 08, 2020, 12:48:50 PM
Which leaves one question: For some of the folders, I have camera jpgs and rafs in 2 different folders, and was wondering about the syntax.
/raf
/jpg
What would be the syntax for reading from the jpg directory and writing to the raf directory?

You would need to change the %d in
-tagsfromfile %d%f.jpg
to something to represent the path to the jpgs.  It can be a relative path to the one being processed, an absolute path to the jpgs, or you can use the advanced features of the %d variable to get the right path (see the -w (textout) option for details).
"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

msandersen

Right, so can you simply use -tagsfromfile ../jpg/%f.jpgwhere your directory is /directory/Raf/ and you want to copy from the jgs in /directory/jpg/ ?

StarGeek

"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

msandersen

#28
Thanks, but unfortunately that produces an error:
QuoteWarning: Error opening file - ../jpg/Image0001-[2020-07-01].jpg

Edit:
I managed to make it work with
-tagsfromfile %-:1d/jpg/%f.jpg
Still don't know why the other way doesn't work, though I'm glad this way works.

StarGeek

Hmmm... not sure why it didn't work for you, works here.  But at least you got it working.
Y:\!temp\cccc\B>exiftool -description ../A .
======== ../A/06-07-_2020_19-04-02.jpg
Description                     : Test desc
======== ./06-07-_2020_19-04-02.jpg
    2 directories scanned
    2 image files read

Y:\!temp\cccc\B>exiftool -P -overwrite_original -TagsFromFile ../A/%f.%e -description .
    1 directories scanned
    1 image files updated

Y:\!temp\cccc\B>exiftool -description ../A .
======== ../A/06-07-_2020_19-04-02.jpg
Description                     : Test desc
======== ./06-07-_2020_19-04-02.jpg
Description                     : Test desc
    2 directories scanned
    2 image files read
"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