ExifTool Forum

ExifTool => Developers => Topic started by: herb on March 18, 2022, 07:15:23 AM

Title: Questions to options -m and -f -api missingtagvalue=
Post by: herb on March 18, 2022, 07:15:23 AM
Hello Phil,

In the following I talk about the usecase to assign the value of tag1 also to tag2
exiftool.exe -tag2 < $tag1

In detail I have questions when tag1 is missing in sourcefile.

(1) Without any further option Exiftool does nothing
(2) Using also option -m Exiftool
    - ignores minor warnings and
    - value of tag1 is handled as empty string (with length 0)
(3) Using also option -f and -api missingtagvalue=x
    - tag2 gets value x assigned
(4) Using also option -m and -api missingtagvalue=x
    - ignores minor warnings and
    - tag2 gets value x assigned

Now my question:
Is it also possible to set missingtagvalue to an empty string (length 0)
in order to have:
- value of tag1 is handled as empty string (with length 0)
- AND Exiftool does NOT ignore minor warnings

Thanks for your help in advance
Best regards
herb
Title: Re: Questions to options -m and -f -api missingtagvalue=
Post by: StarGeek on March 18, 2022, 10:46:24 AM
I am unable to do so under Windows.  Using -f -api missingtagvalue="" results in the default dash being used.
Title: Re: Questions to options -m and -f -api missingtagvalue=
Post by: Phil Harvey on March 18, 2022, 01:10:26 PM
Use ^= to set any option or tag value to an empty string.

- Phil
Title: Re: Questions to options -m and -f -api missingtagvalue=
Post by: StarGeek on March 18, 2022, 01:20:46 PM
I believe the context is this thread (https://exiftool.org/forum/index.php?topic=13406.0) where the command
exiftool "-ImageDescription<$IPTC:City $IPTC:Province-State $IPTC:Country-PrimaryLocationName" file.jpg
would fail if Province-State didn't exist.

What herb wants is to use a empty string for -f -api missingtagvalue without suppressing minor errors -m.

Though my thought is that you're still going to have to edit afterwards in order to change the two spaces into a single space.  Overall, I think either the user defined tag or the shortcut I mention in that thread is the easiest option if you were dealing with trying to combine more than a few tags.
Title: Re: Questions to options -m and -f -api missingtagvalue=
Post by: Phil Harvey on March 18, 2022, 01:29:07 PM
Quote from: StarGeek on March 18, 2022, 01:20:46 PM
What herb wants is to use a empty string for -f -api missingtagvalue without suppressing minor errors -m.

Yes.  This should work (-f or -m not needed):

exiftool -api missingtagvalue^= ...

QuoteThough my thought is that you're still going to have to edit afterwards in order to change the two spaces into a single space.  Overall, I think either the user defined tag or the shortcut I mention in that thread is the easiest option if you were dealing with trying to combine more than a few tags.

Agreed.

- Phil
Title: Re: Questions to options -m and -f -api missingtagvalue=
Post by: StarGeek on March 18, 2022, 03:13:45 PM
I tried that and made an error that I should have remembered.  The caret is special in Windows command line.

-api "missingtagvalue^="
works with the added quotes.
Title: Re: Questions to options -m and -f -api missingtagvalue=
Post by: herb on March 19, 2022, 05:02:42 AM
Hello StarGeek, hello Phil

thank you very much for your investigations and your comments.
QuoteUse ^= to set any option or tag value to an empty string.
Wow! Great feature.
I never had such an idea and will continue with this.

Thanks again and
Best regards
herb