ExifTool Forum

ExifTool => Newbies => Topic started by: praetor on June 06, 2019, 03:34:54 PM

Title: -TagsFromFile
Post by: praetor on June 06, 2019, 03:34:54 PM
I need help with the -TagsFromFile command:

There are a number of JPG files in a folder c:\Users\praet\Downloads\test1\. In a second folder c:\Users\praet\Downloads\test2 there are files with the same name.
The meta data should be transferred from the files in the first folder to the files with the same name in the second folder.

I have tried:
exiftool.exe -v3 tagsFromFile c:\Users\praet\Downloads\test1 -exif: all c:\Users\praet\Downloads\test2
or
exiftool.exe -v3 tagsFromFile c:\Users\praet\Downloads\test1 -exif: all c:\Users\praet\Downloads\test2\

Unfortunately that does not lead to success.
Title: Re: -TagsFromFile
Post by: Phil Harvey on June 06, 2019, 03:55:17 PM
Try this:

exiftool -tagsfromfile c:\Users\praet\Downloads\test1\%f.%e -exif:all c:\Users\praet\Downloads\test2

- Phil
Title: Re: -TagsFromFile
Post by: praetor on June 07, 2019, 03:38:00 AM
Many thanks Phil! This works great.  :D
Title: Re: -TagsFromFile
Post by: BC1 on June 25, 2019, 11:25:10 AM
Hi - I am completely new to ExifTool and I am trying to copy the IPTC data from a number of RAW CR2 files in folder InputRAW to a number of TIF files with the same names in another folder OutputTifs. I attempted to follow the example given in this thread by using the following command:

exiftool -tagsfromfile d:\inputRAW\%f.%e -exif:all d:\OutputTifs

A few errors flashed up briefly on the screen but the window closed before I could read them.
Title: Re: -TagsFromFile
Post by: Phil Harvey on June 25, 2019, 11:37:57 AM
Add -k to the command so the window doesn't close.

- Phil
Title: Re: -TagsFromFile
Post by: StarGeek on June 25, 2019, 12:44:36 PM
Quote from: BC1 on June 25, 2019, 11:25:10 AM
Hi - I am completely new to ExifTool and I am trying to copy the IPTC data from a number of RAW CR2 files in folder InputRAW to a number of TIF files with the same names in another folder OutputTifs. I attempted to follow the example given in this thread by using the following command:

exiftool -tagsfromfile d:\inputRAW\%f.%e -exif:all d:\OutputTifs

A couple of notes.  This command will only copy data in the EXIF block.  It won't copy either IPTC (IIE Legacy) or XMP (IPTC Core) data.  To do that, you would want to add -IPTC:All and/or -XMP:All.

Additionally, it won't copy from CR2 to TIF.  Assuming the d:\OutputTifs only contains TIF files, it would look in the directory d:\inputRAW for a file with the exact same base name (due to the %f) and the exact same extension (due to the %e).  If you want to copy from CR2 files, you would want to use  d:\inputRAW\%f.CR2

Also, if you are doing this in a BAT file, remember to double the percent signs %.

I would suggest testing things out in CMD first so you can see the full results more easily before moving to a drag/drop solution.
Title: Re: -TagsFromFile
Post by: BC1 on June 26, 2019, 04:35:05 AM
Thanks for your advice. I tried the following 2 options:

exiftool -tagsfromfile d:\inputRAW\%f.CR2 -IPTC:all d:\OutputTifs

exiftool -tagsfromfile d:\inputRAW\%f.CR2 -XMP:all d:\OutputTifs

They didn't work I'm afraid and produced error messages in the exiftools window, but this closed before I could read them. I did try

exiftool $info = $exifTool->GetInfo('Error', 'Warning')

to retrieve the messages, but again the window appeared too briefly for me to read them!

I am running Windows 10 and running in CMD. The input folder contains 3 Canon RAW files (.CR2). The output folder contains the same 3 images as 16 bit tif files converted using DPP 4, which doesn't read the XMP sidecar file so doesn't include the IPTC information I added to the RAW files, so this is not passed on the the tif file.
Title: Re: -TagsFromFile
Post by: BC1 on June 26, 2019, 05:58:21 AM
Update to previous post - Looking back on previous posts I added -k to the command which retained the messages window and they turned out not to be error messages after all:

1 directories scanned
3 image files updated

Problem is the tifs have not been updated........

Next I converted the CR2 files to dng files using Abobe DNG Converter and put them in a folder named DNG. I then run the following CMD:

exiftool -tagsfromfile d:\DNG\%f.dng -IPTC:all d:\OutputTifs -k

This failed with 'No writable tags set from d:DNG for each image filename.

Then tried:

exiftool -tagsfromfile d:\DNG\%f.dng -XMP:all d:\OutputTifs -k

This worked!

So is it not possible to copy IPTC data entered on a RAW file because it it stored in the XMP sidecar file? When converted to dng format the data appears to be incorported within the file as there is not a separate XMP file.

Title: Re: -TagsFromFile
Post by: Phil Harvey on June 26, 2019, 07:16:00 AM
What ExifTool calls IPTC is the old IPTC/IIM format, which can't be store in an XMP file.  However, there are IPTC tags for XMP (https://exiftool.org/TagNames/XMP.html#iptcCore).

Also, if ExifTool says that a file was updated, then something was written.  Add the -v2 option to the command to get more details about what was written.

- Phil
Title: Re: -TagsFromFile
Post by: BC1 on June 26, 2019, 11:54:17 AM
Hi Phil,

Added the -v2 as you suggested and it showed that many fields were 'rewritten' including the IPTC data that I am after, although they did not appear on the tif files.

I have looked into this further and it appears that a previous 'failed' run of exiftool had actually added a single entry to the IPTC data which was 'urgency 5'. This was not visible on the standard display in BreezeBrowser which showed empty fields for all IPTC data, but does appear when the Image Properties window is viewed. When I viewed the original tif files in this way the 'urgency 5' was not there. I then replaced the 'urgency 5' tif files in the output folder with fresh copies of the tif files without the 'urgency 5' and rerun the CMD. Much to my surprise this worked! Quite why the entry on the tif file prevented the writing of the IPTC data I don't know, but it does now work. Thanks for your help and this very useful tool. This means that I can now use DPP 4 for my RAW conversions as it doesn't read the XMP sidecar file so the description I write to the RAW file is not picked up, so not written to the tif file it creates.



Title: Re: -TagsFromFile
Post by: Phil Harvey on June 26, 2019, 12:28:06 PM
Quote from: BC1 on June 26, 2019, 11:54:17 AM
they did not appear on the tif files.

Using what software to read them?  Is this perhaps FAQ 3 (https://exiftool.org/faq.html#Q3)?

QuoteQuite why the entry on the tif file prevented the writing of the IPTC data I don't know, but it does now work.

It shouldn't prevent the writing, but it may prevent the reading if you weren't using ExifTool for this.

- Phil
Title: Re: -TagsFromFile
Post by: BC1 on June 27, 2019, 03:36:19 AM
I am using BreezeBrowser to add the IPTC data to the RAW file. This uses the XMP sidecar file to store it. Canon's DPP 4 doesn't read this file so doesn't see this data (I've contacted Canon and they confirm this). I add Author and Description and change the Copyright Status from 'unknown' to Copyrighted. The Urgency field is already set to 5: Normal. This is a field I'm not interested in so I leave it alone.

When viewing the tif file results of the exiftool copy I also use BreezeBrowser as this is the software I use to maintain my image library. If it doesn't show in BreezeBrowser it isn't any use to me. I did also try using DPP 4 to view the IPTC data on the tif and this was the same as BreezeBrowser.

Note that using XMP rather than IPTC in the CMD does update any of the fields I require.

Also I've just noticed that altough the other fields on the IPTC are successfully copied, the Copyright Status is not updated from 'Copyrighted' on the CR2 and remains at the default 'Unkown' on the tif file.



Title: -TagsFromFile
Post by: Taniwha on February 23, 2021, 08:07:40 AM
I want to transfer the following (and only the following) GPS data from an XMP file to the EXIF section of a jpeg.

Example:
<rdf:Description rdf:about=''
  xmlns:exif='http://ns.adobe.com/exif/1.0/'>
  <exif:GPSAltitude>54/1</exif:GPSAltitude>
  <exif:GPSAltitudeRef>0</exif:GPSAltitudeRef>
  <exif:GPSImgDirection>??/???</exif:GPSImgDirection>
  <exif:GPSImgDirectionRef>T</exif:GPSImgDirectionRef>
  <exif:GPSLatitude>??,??.???N</exif:GPSLatitude>
  <exif:GPSLongitude>??,??.???E</exif:GPSLongitude>
  <exif:GPSMapDatum>WGS-84</exif:GPSMapDatum>
  <exif:GPSVersionID>2.2.0.0</exif:GPSVersionID>
</rdf:Description>


I do not want to transfer any other information that might be included in the XMP file, hence I avoided using the command
-EXIF:all < XMP-exif:all

So, I started by using the -TagsFromFile option with a specific list file.

This list file looks like this:
-GPS:GPSVersionID < XMP-exif:GPSVersionID
-exif:GPSLatitudeRef < XMP-exif:GPSLatitudeRef
-exif:GPSLatitude < XMP-exif:GPSLatitude
-exif:GPSLongitudeRef < XMP-exif:GPSLongitudeRef
-exif:GPSLongitude < XMP-exif:GPSLongitude
-exif:GPSAltitudeRef < XMP-exif:GPSAltitudeRef
-exif:GPSAltitude < XMP-exif:GPSAltitude
-exif:GPSImgDirection < XMP-exif:GPSImgDirection
-exif:GPSImgDirectionRef < XMP-exif:GPSImgDirectionRef
-exif:GPSMapDatum < XMP-exif:GPSMapDatum


This seems to work after checking the image location data with IrfanView.
Alternatively, I tried the following, apparently with the same result:

-GPS:GPSVersionID < XMP-exif:GPSVersionID
-GPS:GPSLatitudeRef < XMP-exif:GPSLatitudeRef
...
-GPS:GPSImgDirectionRef < XMP-exif:GPSImgDirectionRef
-GPS:GPSMapDatum < XMP-exif:GPSMapDatum


What exactly is the difference between the two command options -exif: and -GPS: ?

Also, the command
-exif:GPSMapDatum < XMP-exif:GPSMapDatum
doesn't seem to work. It does transfer 'GPSMapDatum' when using
-EXIF:all < XMP-exif:all

Any ideas that help me understand?  Thanks a lot!
J.
Title: Re: -TagsFromFile
Post by: Phil Harvey on February 23, 2021, 10:38:23 AM
First, note that XMP-exif:GPSLatitudeRef/GPSLongitudeRef are nonstandard.

Quote from: Taniwha on February 23, 2021, 08:07:40 AM
I do not want to transfer any other information that might be included in the XMP file, hence I avoided using the command
-EXIF:all < XMP-exif:all

I would have suggested using the xmp2gps.args (https://raw.githubusercontent.com/exiftool/exiftool/master/arg_files/xmp2gps.args) argfile, but it assumes that the XMP was written correctly.

Barring that, -gps:all<xmp:all should handle the incorrect XMP Lat/Lon Ref tags.

QuoteWhat exactly is the difference between the two command options -exif: and -GPS: ?

There is no difference since the named tags only exist in one location in the EXIF.  But if you used EXIF in my suggestion above you could also copy some tags you didn't want.

QuoteAlso, the command
-exif:GPSMapDatum < XMP-exif:GPSMapDatum
doesn't seem to work. It does transfer 'GPSMapDatum' when using
-EXIF:all < XMP-exif:all

This works for me.  A specific example and sample file will be needed to reproduce the result you are seeing.

- Phil
Title: Re: -TagsFromFile
Post by: StarGeek on February 23, 2021, 10:48:15 AM
Quote from: Taniwha on February 23, 2021, 08:07:40 AMI do not want to transfer any other information that might be included in the XMP file

I'd suggest using the xmp2gps.args (https://raw.githubusercontent.com/exiftool/exiftool/master/arg_files/xmp2gps.args) file, since that was specifically created for this purpose.  Save it to the same directory as exiftool and run something like this
exiftool -TagsFromFile %d%f.xmp -@ xmp2gps.args /path/to/files/

QuoteWhat exactly is the difference between the two command options -exif: and -GPS: ?

Functionally, no difference.

QuoteAlso, the command
-exif:GPSMapDatum < XMP-exif:GPSMapDatum
doesn't seem to work. It does transfer 'GPSMapDatum' when using
-EXIF:all < XMP-exif:all

I can't seem to reproduce that here.  Try running a command with just that copy operation and add -v3 (https://exiftool.org/exiftool_pod.html#v-NUM--verbose#v-NUM--verbose) to the command to get verbose output.