What's the meaning of -f , exactly?

Started by Mac2, October 15, 2011, 09:20:22 AM

Previous topic - Next topic

Mac2

When combining -use mwg with -f ExifTool emits a hyphen for some tags, including keywords.
This is especially disturbing in XML output because I cannot tell if the file really did contain a "-" keyword or if this has been added by ExifTool.

<MWG:Keywords>
  <rdf:Description et:id='Keywords' et:table='Composite'>
   <et:desc>Keywords</et:desc>
   <et:prt>-</et:prt>
   <et:val></et:val>
  </rdf:Description>
</MWG:Keywords>


This behavior seems to be tied to mwg only because neither IPTC or XMP data emits non-existing keywords or other tags.

I have added this flag for a reason but now with -usw mwg I'm not sure anymore if I want this and why I added this. The documentation for -f is not that clear (to me) so I wonder what exactly does -f do and why would I use it?


Phil Harvey

The main purpose of -f is to force output of all tags specified on the command line, whether or not they existed.  If they don't exist, they are output with a value of "-".  This feature is mentioned in FAQ number 12 (although I should also document this with the -f option).

What is  unexpected is that MWG:Keywords is emitted when it is empty.  In this case I would expect Unknown:Keywords to be written.  I would like to understand this, but can't replicate this behaviour.  Could you email me the exact command you used and a sample image so I can look into this?  Thanks.

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

Mac2

Hi, Phil

the command line is

exiftool -X -G1 -f -use mwg -mwg:all "c:\image.jpg"

I made some more experiments and it seems to happen only with certain images where I before removed all keywords with ExifTool and a command line similar to

exiftool -xmp:keywords= -iptc:keywords= ...

The sample file is in your email.

Phil Harvey

Thanks.  I see the problem.  Combining -f with -mwg:all can print missing MWG tags, while the normal behaviour of -f -GROUP:all would be to print nothing if no tags in the group exist.  Interesting.  The difference is due to the way the Composite MWG tags are generated.  I will look into this to see if I can solve this problem.

But in the mean time:  Why are you using -f?  This option is used just to force missing tags to be printed (but was intended to effect only specifically named tags, not tags like "all" or tags with wildcards).  So just dropping -f may solve your problem.

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

Phil Harvey

Nailed it.  This will be fixed in version 8.68.

You're really on a roll here.  It is great to tidy up confusing little inconsistencies like this.  Thank you for reporting these.  I hate to say it, but these may be turning up now because you may be the first one to make such extensive use of the MWG feature.  That and your keen eye for detail of course.

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

Phil Harvey

BTW. I never answered your question about why you would use the -f option:

The original purpose of this option is to keep columns aligned when extracting information for specific tags using -t.  Its purpose when combined with -X is dubious at best.

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

Mac2

Hi, Phil

thanks again for spending time trying to figure out these things  :)

I added -f quite a while ago, after reading all (most) the information on your web site about the exiftool.exe command line app, the FAQ's and basically everything else there is. Using -f did apparently not harm until I tried to make my code more MWG compliant and switching to -use MWG.
Metadata is basically a big mess and perhaps sticking to something like MWG will make the metadata quality better, given time. I wish. For my users.

My application has to handle images taken and meta-'dated over the past 15 years, with a wide variety of tools and applications. This generates a bigger mess and variety of metadata than one ever would care to think of. Which is why I often stumble upon such strange issues and quirks.

The quality of ExifTool is excellent and I'd really wish all the components, 3rd party libraries and run-times I have to work with would be as good and solid  And there is even a documentation you can rely on. Heaven! Just...need...to wrap my brain around this mass of information ::)

Anticipatory to your suggestion I have removed -f from my ingesting ARGS file an the problem is gone.