Special question to copying tags

Started by herb, June 05, 2022, 12:27:10 PM

Previous topic - Next topic

herb

Hello Phil,

I have a question (need a private lession) for copying tags.
I want
- to copy e.g. all xmp-tags that are known to ExifTool - unknown tags must not be copied
  (so xmp cannot be copied as a block)
- that the copied tags remain inside their current group
  (I agree it is a more theoretical situation)

FAQ 9 states the following
Quote# copy XMP tags to XMP group (destination group 'xmp')
# [the destination family 1 group is the preferred XMP namespace]
exiftool -tagsfromfile src.jpg "-xmp:all" dst.jpg
exiftool -tagsfromfile src.jpg "-xmp:all>xmp:all" dst.jpg
# copy XMP tags, preserving family 1 group (destination group 'all')
exiftool -tagsfromfile src.jpg "-xmp:all>all:all" dst.jpg
Because of this I think the following command should be used
exiftool  -tagsfromfile srcfile -xmp:all>all:all dstfile

But is really guaranteed that no Exif-tag and no IPTC-tag (with identical tagname) is overwritten?

Thanks for your help in advance
Best regards
herb

StarGeek

All of the above will only copy XMP data into XMP, not into EXIF or IPTC.

Though it does bring up a subtle point I wasn't really aware of.  I've always used just -XMP:All to copy the XMP tags, and in most cases, that will be enough, as this will really not change the location of most XMP tags.  But there are some tags which will change. This would be most notable for users of ACDSee, as that program creates a bunch of tags in their own name space that duplicate the more standard tag names.  I don't think this would be too much of a problem, as I would guess that ADCSee will also read the data from those more common tags.

There's a few others, but they are mostly specific to certain software, again, mostly duplicating tags that are part of the more common standards.  Also the XMP-pdf tags have some names duplicated in other image namespaces.  Basically anything marked as Avoid, those with a trailing slash in the Writable column, on the XMP tags page should be double checked.

tl;dr
Using -XMP:All would be good enough in most cases but if you want to be perfectly accurate, then go with -XMP:All>All:All as you said.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

herb

Hello Phil, hello StarGeek

@StarGeek: Thanks for your comments and investigations.

Although I use ExifTool for many years now, I was only aware of this feature using with taggroup ALL.

Sorry for my late reply, but I had to think about some more details of this feature.
I think the following details are valid:
(1) >all:all can be used together with categries
      e.g.: -xmp:author:all > all:all

(2) in case of using it for a family-1 group there is no difference between
     - taggroup:all and -taggroup:all>all
      (e.g.: -xmp-acdsee:all and -xmp-acdsee:all>all )

(3) the following commands copying family-0 groups
          exiftool -tagsfromfile scrfile -taggroupX:all>all:all dstfile
          exiftool -tagsfromfile scrfile -taggroupY:all         dstfile
    do the same as the following command
          exiftool -tagsfromfile scrfile -taggroupX:all>all:all -taggroupY:all dstfile
    In other words:
    >all:all with taggroupX has no side-effect to -taggroupY:all

    I do not need to use >all:all for all groups-to-be-copied when I use it for 1 group within 1 command


Thanks for your comments and help in advance
Best regards
herb

Phil Harvey

Not quite.  See my bold sections from the documentation:

       -tagsFromFile SRCFILE or FMT
            Copy tag values from SRCFILE to FILE.  Tag names on the command
            line after this option specify the tags to be copied, or excluded
            from the copy.  Wildcards are permitted in these tag names.  If no
            tags are specified, then all possible tags (see note 1 below) from
            the source file are copied to same-named tags in the preferred
            location of the output file (the same as specifying "-all").  More
            than one -tagsFromFile option may be used to copy tags from
            multiple files.

            By default, this option will update any existing and writable
            same-named tags in the output FILE, but will create new tags only
            in their preferred groups.  This allows some information to be
            automatically transferred to the appropriate group when copying
            between images of different formats. However, if a group name is
            specified for a tag then the information is written only to this
            group (unless redirected to another group
, see below).  If "All"
            is used as a group name, then the specified tag(s) are written to
            the same family 1 group they had in the source file (ie. the same
            specific location, like ExifIFD or XMP-dc).  For example, the
            common operation of copying all writable tags to the same specific
            locations in the output FILE is achieved by adding "-all:all".  A
            different family may be specified by adding a leading family
            number to the group name (eg. "-0all:all" preserves the same
            general location, like EXIF or XMP).

            SRCFILE may be the same as FILE to move information around within
            a single file.  In this case, "@" may be used to represent the
            source file (ie. "-tagsFromFile @"), permitting this feature to be
            used for batch processing multiple files.  Specified tags are then
            copied from each file in turn as it is rewritten.  For advanced
            batch use, the source file name may also be specified using a FMT
            string in which %d, %f and %e represent the directory, file name
            and extension of FILE.  (eg. the current FILE would be represented
            by "%d%f.%e", with the same effect as "@").  See the -w option for
            FMT string examples.

            A powerful redirection feature allows a destination tag to be
            specified for each copied tag.  With this feature, information may
            be written to a tag with a different name or group.  This is done
            using "'-DSTTAG<SRCTAG'" or "'-SRCTAG>DSTTAG'" on the command line
            after -tagsFromFile, and causes the value of SRCTAG to be copied
            from SRCFILE and written to DSTTAG in FILE.  Has no effect unless
            SRCTAG exists in SRCFILE.  Note that this argument must be quoted
            to prevent shell redirection, and there is no "=" sign as when
            assigning new values.  Source and/or destination tags may be
            prefixed by a group name and/or suffixed by "#".  Wildcards are
            allowed in both the source and destination tag names.  A
            destination group
and/or tag name of "All" or "*" writes to the
            same family 1 group
and/or tag name as the source. If no
            destination group is specified, the information is written to the
            preferred group.
  Whitespace around the ">" or "<" is ignored. As
            a convenience, "-tagsFromFile @" is assumed for any redirected
            tags which are specified without a prior -tagsFromFile option.
            Copied tags may also be added or deleted from a list with
            arguments of the form "'-SRCTAG+<DSTTAG'" or "'-SRCTAG-<DSTTAG'".


Quote from: herb on June 10, 2022, 01:42:37 PM
(1) >all:all can be used together with categries
      e.g.: -xmp:author:all > all:all

(2) in case of using it for a family-1 group there is no difference between
     - taggroup:all and -taggroup:all>all
      (e.g.: -xmp-acdsee:all and -xmp-acdsee:all>all )

No.  -xmp-acdsee:all is the same as -xmp-acdsee:all>xmp-acdsee:all.

Quote(3) the following commands copying family-0 groups
          exiftool -tagsfromfile scrfile -taggroupX:all>all:all dstfile
          exiftool -tagsfromfile scrfile -taggroupY:all         dstfile

    do the same as the following command
          exiftool -tagsfromfile scrfile -taggroupX:all>all:all -taggroupY:all dstfile[/quote]

Yes, as long as there is no overlap between the groups.

QuoteIn other words:
    >all:all with taggroupX has no side-effect to -taggroupY:all

    I do not need to use >all:all for all groups-to-be-copied when I use it for 1 group within 1 command

Using >all:all changes the behaviour as I mentioned above.  It writes to the same family 1 group, not the same family 0 group if you are specifying a family 0 group as a source.

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

herb

Hello Phil,

thanks for your detailed comments pointing me to the right direction.
QuoteNo.  -xmp-acdsee:all is the same as -xmp-acdsee:all>xmp-acdsee:all
Yes you are right.

But looking on the results of the 2 commands for family-1 taggroups:
Quoteexiftool -tagsfromfile scrfile  -family-1-group:all>all:all dstfile
exiftool -tagsfromfile scrfile  -family-1-group:all           dstfile
will one of these commands write tags outside that family-1-group?

Best regards
herb

Phil Harvey

If you are using a family 1 group with the source tag name, then there is no difference between those.

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