copy XMP from xmp sidecar to JPG in another folder

Started by Ferdinand Paris, October 06, 2012, 08:57:28 AM

Previous topic - Next topic

Ferdinand Paris

I am using XMP sidecar files to store metadata for Sony ARW files.  I want to copy the XMP information from the sidecar to the developed JPG, which is in another folder.  Because this is part of a script that I wrote for iMatch 3.6, I am using arg files.  My command line is

"C:\Program Files\ExifTool\exiftool.exe" -@ "C:\DOCUME~1\User\LOCALS~1\Temp\FP_Sync_temp.args"

and the arg file I created is:

Quote-tagsFromFile
"E:\My Photos\2-Indexed Test\2012\2012_10_03\20121003_13h40m34s_nex7_2933.xmp"
-overwrite_original_in_place
-xmp:all
  -Orientation=1
-n
"E:\My Photos\2-Indexed Test\2012\2012_10_03\Gallery3\20121003_13h40m34s_nex7_2933-pp3.jpg"
-execute

But the error I get is

QuoteC:\Documents and Settings\User>"C:\Program Files\ExifTool\exiftool.exe" -@ "C:\
DOCUME~1\User\LOCALS~1\Temp\FP_Sync_temp.args"
Ignored superfluous tag names or invalid options: -Tagsfromfile  ...
Error: File not found - "E:/My Photos/2-Indexed Test/2012/2012_10_03/20121003_13
h40m34s_nex7_2933.xmp"
Error: File not found - "E:/My Photos/2-Indexed Test/2012/2012_10_03/Gallery3/20
121003_13h40m34s_nex7_2933-pp3.jpg"
    0 image files updated
    2 files weren't updated due to errors

I've spent a lot of time searching and reading, and I still can't quite crack what it is I need to get Exiftool read from the sidecar.  Most of the examples I found were in relation to inserting GPS from a sidecar into the matching file.

F_P

Phil Harvey

From the exiftool application documentation for the -@ option:

       -@ ARGFILE
            Read command-line arguments from the specified file.  The file
            contains one argument per line (NOT one option per line -- some
            options require additional arguments, and all arguments must be
            placed on separate lines).  Blank lines and lines beginning with
            "#" and are ignored.  Normal shell processing of arguments is not
            performed, which among other things means that arguments should
            not be quoted. [...]


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

Ferdinand Paris

Thanks, Phil.  How embarrassing!!  I've used args files before in my iMatch scripts that interface with Exiftool, so I must have discovered this and forgotten it again.  I also rediscovered the point about no leading or trailing spaces - that's correct, isn't it?

I managed to work out for myself that in this case the XMP copy command should have been
-all>xmp:all
That's also right, isn't it?  Is that the best option in this instance?  It seems to work.

Given that many people store all their metadata for their RAW files in sidecars, and will want to copy it to the corresponding JPG/TIFF, I wonder whether this might be an example worth including with all the others in the documentation?

F_P

Phil Harvey

Quote from: Ferdinand Paris on October 07, 2012, 02:39:56 AM
Thanks, Phil.  How embarrassing!!  I've used args files before in my iMatch scripts that interface with Exiftool, so I must have discovered this and forgotten it again.

:)

QuoteI also rediscovered the point about no leading or trailing spaces - that's correct, isn't it?

Right.  Before ExifTool 8.69 I did trim leading/trailing spaces from lines in the argfile, but some people complained so I changed this.  (Otherwise there is no way to put spaces in if you really want them.)

QuoteI managed to work out for myself that in this case the XMP copy command should have been
-all>xmp:all
That's also right, isn't it?  Is that the best option in this instance?  It seems to work.

It all depends on what you want to do.  You're copying from an XMP file, so -all>xmp:all is equivalent to -all:all after -tagsfromfile.  Both will copy all tags from the XMP file into XMP in the destination.  Another way is to specify just -xmp, which will copy the XMP as a block, but this will avoid the 2 kB of padding recommended by the XMP specification (a waste of space anyway in my opinion).

QuoteGiven that many people store all their metadata for their RAW files in sidecars, and will want to copy it to the corresponding JPG/TIFF, I wonder whether this might be an example worth including with all the others in the documentation?

I've added examples 9 and 10 to the sidecar files page.

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

Ferdinand Paris

Quote from: Phil Harvey on October 07, 2012, 08:53:01 AM
It all depends on what you want to do.  You're copying from an XMP file, so -all>xmp:all is equivalent to -all:all after -tagsfromfile.  Both will copy all tags from the XMP file into XMP in the destination.  Another way is to specify just -xmp, which will copy the XMP as a block, but this will avoid the 2 kB of padding recommended by the XMP specification (a waste of space anyway in my opinion).
I thought that -all>xmp:all made a difference compared to -all:all, but perhaps I trimmed spaces at the same time.  Thanks for your help.

F_P

Phil Harvey

Quote from: Ferdinand Paris on October 07, 2012, 10:45:49 AM
I thought that -all>xmp:all made a difference compared to -all:all

Normally it would, but in this case (copying from an XMP file) only XMP tags exist in the source file, so preserving the original group (-all:all) is equivalent to copying all tags to the XMP group (-all>xmp:all).

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