ExifTool Forum

ExifTool => Archives => Topic started by: Archive on May 12, 2010, 08:54:42 AM

Title: 'Self-batching' exiftool, and tag properties.
Post by: Archive on May 12, 2010, 08:54:42 AM
[Originally posted by unsolicited on 2009-11-24 21:17:23-08]

Code:
Prefix: I don't know much about exif (in the sense of the 'object properties', etc., XMP, how it's
used, contexts, and so on) so that colours the text below. I understand data. And I understand that
exiftool allows me to expose the data so I can investigate the object properties.

Is it possible to 'self-batch' exiftool. i.e. I would like to run exiftool on a .jpg that I've set
all the properties on, having it create a batch (.cmd) script that I can then feed back into
%comspec% / exiftool to set the same properties on another .jpg. Yes, I'm on windows. e.g.

exiftool <arg> templatedir/template.jpg >doit.cmd
for %a in (*.jpg) do doit %a

or, more likely:

exiftool <arg> templatedir/template.jpg >doit.exiftooldata.txt
for %a in (*.jpg) do exiftool -@ doit.exiftooldata.txt %a

i.e. the initial resulting output being human readable (.txt file) so I can edit it (say, with
notepad) to strip out all the appropriate stuff that wouldn't apply to every other file I plan to
apply it to. An .mie file isn't sufficient, it must be textual.

Is this sort of construct possible?

I get that I'm probably not going to get the one parameter with args per line that I would like,
that not being the format of the @ input file. It being easier to see nouns, verbs, and adjectives
all on one line, rather than having to scan down to figure out how many lines apply to this first
one. Sort of like reading braces in code, I guess.

if (a>b) c=a; a=b; [being easier to read, but not always appropriate, than]
if (a>b)
{
  c=a;
  a=b;
} [being easier to read, than]
if (a>b) {
  c=a;
  a=b;
}

Further, could exiftool's text output have an option to list each line with the entire tag? e.g. -X
shows the entire tag 'path' (?). It would facilitate editing this output file. Currently, many
lines, say, have 'resolution' and either I have to scan to see what group it's applying to, or
can't see what group it's applying to at all. (e.g. with/out -g)

Finally, if there are restrictions to a tag, could they also be listed in the exiftool output. (I
don't know that there are, according to the spec. I get that application implementations may
self-impose a limit. It's the spec that I'm interested in, here.] Currently if the data is binary,
that is well delineated (and an option to not list such tags would be welcome [, again, reducing
the number of lines under consideration in editing this output file.] I'm thinking, for example, if
a copyright tag has a maximum length, the length being shown in the output line, e.g.
copyright(15), would be useful.

- and if there are such limits, the man page explicitly indicating that exiftool will truncate
input, would be welcome. Or whatever it does do.

Referring back to my prefix above, exiftool allows me to start to grok the nature of the beast, and
"what's in there" so I can determine what is of interest to me or I care about. I haven't yet
gotten as far as understanding the ramifications of each tag line or its properties, but I'm
working on that.

Hopefully I've conveyed where I'm trying to get (self-batching exiftool). Am I thinking correctly /
is there a (better) way to travel this road?

Thanks for any thoughts.
Title: Re: 'Self-batching' exiftool, and tag properties.
Post by: Archive on May 12, 2010, 08:54:42 AM
[Originally posted by exiftool on 2009-11-24 22:17:14-08]

Wow.  That's a big wish list.

To start, I think the XML output (-X option)
gives you a text file which suits most of your needs.
With any luck you shouldn't have to get into "self-batching".
You can output the XML file then edit it however you
want then read back in whatever tags you want and apply
them to any number of files.  For example:

Code:
exiftool -X image.jpg > out.xml
 [edit out.xml in your text editor]
 exiftool -tagsfromfile out.xml -iptc:all -xmp:all DIR

In this example, I write all IPTC and XMP tags from
the XML file to all images in directory DIR.

This type of output doesn't give you an indication of
any tag characteristics (format, length limits, etc),
but you can use the following command to get this
information for all IPTC tags:

Code:
exiftool -listx -iptc:all -f

- Phil
Title: Re: 'Self-batching' exiftool, and tag properties.
Post by: Archive on May 12, 2010, 08:54:42 AM
[Originally posted by unsolicited on 2009-11-25 07:29:28-08]


Probably not as big a wish list as it appears. Hopefully you can appreciate where I'm trying to get. e.g. it would be nice to see self-documented the max. length of a tag (assuming exiftool truncates), and have documented that exiftool does so, if it does. And hopefully you appreciate the intent behind having the tag on each normal output line specify the full tag path. I agree there'd be a fair bit of drudgery in changing strings and/or having the strings self-document. e.g. The code declaration of the string generating the string's legend. I understand how the problem is made more complex by consideration of the charset.

I'm guessing there's no mandated interpretations/properties for tags? e.g. string length. We're all at the mercy of a particular application's implementation? EXIF, XMP, IPTC, let alone custom tags, you're somewhat at the mercy of the world. Some app. wanting to store a bit of non-standard information important to it, inherently makes it incompatible with other apps., causing ripples of disfunction. <sigh>

Thank you for the code sample, that by far gets me where I'm trying to go, nicely. XML output isn't as human readable as the normal output, but it's a whole lot better than an .mie output file, for text editing. Hopefully you can appreciate the desire of an output format/file that can be used as an input format/file.

In your code sample, you use

exiftool -tagsfromfile out.xml -iptc:all -xmp:all DIR

What am I missing? If you've edited your file to contain only the tags you want generally set on multiple files, why would you not use:

exiftool -tagsfromfile out.xml DIR

Thank you for: exiftool -listx -iptc:all -f

Is IPTC a super-set of all tags? Containing all Exif, XMP, etc., tags, or is it only that the non-IPTC tags don't have such a dictionary associated with them?
Title: Re: 'Self-batching' exiftool, and tag properties.
Post by: Archive on May 12, 2010, 08:54:42 AM
[Originally posted by exiftool on 2009-11-25 11:42:00-08]

Code:
"it would be nice to see self-documented the
max. length of a tag (assuming exiftool truncates), and have documented that
exiftool does so, if it does."

Good point.  I have added this to the
IPTC
tag name documentation
.  IPTC is the only format that has a length
limit like this.

Code:
"And hopefully you appreciate the intent behind
having the tag on each normal output line specify the full tag path."

Yes.  There are other ways to effectively do this too (ie. -G3:1),
but I thought the XML option would be best for you.

Code:
"I'm guessing there's no mandated interpretations/properties for tags? e.g.
string length. We're all at the mercy of a particular application's
implementation? EXIF, XMP, IPTC, let alone custom tags, you're somewhat at
the mercy of the world. Some app. wanting to store a bit of non-standard
information important to it, inherently makes it incompatible with other
apps., causing ripples of disfunction. <sigh>"

Welcome to the metadata madness.

Code:
"Thank you for the code sample, that by far gets me where I'm trying to go,
nicely. XML output isn't as human readable as the normal output, but it's a
whole lot better than an .mie output file, for text editing. Hopefully you
can appreciate the desire of an output format/file that can be used as an
input format/file."

Yes.  That is why I made the XML option.

Code:
"In your code sample, you use
exiftool -tagsfromfile out.xml -iptc:all -xmp:all DIR
What am I missing? If you've edited your file to contain only the tags you
want generally set on multiple files, why would you not use:
exiftool -tagsfromfile out.xml DIR"

Sure.  If the file doesn't contain information you don't want to
write, then writing it all makes sense.  But in this case you
should specify -all:all to copy the tags to the same
location in the target files.

Code:
"Thank you for: exiftool -listx -iptc:all -f

Is IPTC a super-set of all tags? Containing all Exif, XMP, etc., tags, or is
it only that the non-IPTC tags don't have such a dictionary associated with
them?"

No.  That was just an example of how to list the properties
of IPTC tags.  Without -iptc:all the output of the above
command lists the entire exitool tag name database, which is very
large.  You should browse through the html tag name documentation
to get an idea of what you are up against.

- Phil
Title: Re: 'Self-batching' exiftool, and tag properties.
Post by: Archive on May 12, 2010, 08:54:42 AM
[Originally posted by exiftool on 2009-11-26 15:42:55-08]

One more thing:  You mention you'd like a more
human-readable output.  The -s option
makes the XML output much more readable, but
there are associated limitations with this format.
Read the -X documentation for more
details.

- Phil