ExifTool Forum

General => Metadata => Topic started by: ericconn on October 20, 2022, 09:46:52 AM

Title: Writing tags to be null values
Post by: ericconn on October 20, 2022, 09:46:52 AM
Apologies if I'm not reading the documentation correctly, but I'm trying to erase fields, including Keywords, Description, Title and Event. Using -(tag)="" didn't work, neither did -(tag)=. Am I missing a character? Thanks so much.
Title: Re: Writing tags to be null values
Post by: Phil Harvey on October 20, 2022, 11:25:20 AM
Your syntax is correct to delete a tag:

> exiftool a.jpg -keywords
Keywords                        : test
> exiftool a.jpg -keywords=
    1 image files updated
> exiftool a.jpg -keywords
>

If you really want to write a null value, use "^=":

> exiftool a.jpg -keywords^=
    1 image files updated
> exiftool a.jpg -keywords
Keywords                        :
>

I'm not sure, but the caret (^) may need quoting in Windows.

- Phil
Title: Re: Writing tags to be null values
Post by: StarGeek on October 20, 2022, 12:07:41 PM
Quote from: Phil Harvey on October 20, 2022, 11:25:20 AMI'm not sure, but the caret (^) may need quoting in Windows.

You are correct.  The caret ^ is an escape character and needs quoting under Windows CMD but does not need quoting under PowerShell.
Title: Re: Writing tags to be null values
Post by: ericconn on October 20, 2022, 02:56:19 PM
Ok thanks, I figured out the correct syntax but revealed another issue.

C:\Test\Keywords>exiftool -Keywords -Subject -Title -ObjectName -Description -ImageDescription -Caption-Abstract -Event "C:\Test\Keywords\Test.jpg"
Keywords                        : Keywords
Subject                         : Keywords
Title                           : Title
Object Name                     : Title
Description                     : Description
Image Description               : Description
Caption-Abstract                : Description
Event                           : Event

C:\Test\Keywords>pause
Press any key to continue . . .

C:\Test\Keywords>exiftool -Keywords=^"" -Title=^"" -Description=^"" -Event=^"" "C:\Test\Keywords\Test.jpg"
    1 image files updated

C:\Test\Keywords>exiftool -Keywords -Subject -Title -ObjectName -Description -ImageDescription -Caption-Abstract -Event "C:\Test\Keywords\Test.jpg"
Subject                         : Keywords
Object Name                     : Title
Image Description               : Description
Caption-Abstract                : Description


The issue was that, for instance, it was deleting the Keywords field but not Subject, so when looking in Adobe Bridge, I was still seeing the previous Keywords field and Exiftool was telling me it Keywords=null, which was very confusing. Bridge was pulling from the Subject field. When adding/rewriting the Keywords field in the past, it seemed the change would be reflected in the Subject field as well. So for the all the tags I want to clear out, I have to also include the above.

Is this normal to have to change the different iterations (sorry, correct term is evading me) of the same tag when using this command vs. adding/re-writing or am I missing something again about how Exiftool behaves? Thanks so much.
Title: Re: Writing tags to be null values
Post by: Phil Harvey on October 20, 2022, 03:03:47 PM
This is (unfortunately) absolutely normal.  The metadata landscape is a bit of a mess.  Before XMP, IPTC:Keywords was the only place to store this.  But then XMP introduced XMP:Subject which stored the same information.  Applications sometimes use one or other or both.  In general, Adobe prefers XMP.

There is an MWG specification which attempts to standardize some of this, and does specifically address the Keywords/Subject problem.  (See the ExifTool MWG tags (https://exiftool.org/TagNames/MWG.html).)  To take advantage of this you could write the ExifTool MWG:Keywords tag.

- Phil
Title: Re: Writing tags to be null values
Post by: ericconn on October 20, 2022, 03:25:20 PM
Thanks, I misspoke when I thought it rewrote across tags. Bridge just seems to pull from whatever field it wants to, not showing what's still hidden in the metadata.

Either way my problem is solved, I just need to more add more tags to the command. Thanks again.
Title: Re: Writing tags to be null values
Post by: StarGeek on October 20, 2022, 06:05:32 PM
You might try the MWG tags (https://exiftool.org/TagNames/MWG.html).  Setting those will set multiple tags as shown on that page.  I'm pretty sure Bridge follows the MWG standard when reading and writing data.

So you could use
exiftool -MWG:Description^= -MWG:Keywords^= /path/to/files/

And that will set all of these tags
EXIF:ImageDescription
IPTC:Caption-Abstract
XMP-dc:Description
IPTC:Keywords
XMP-dc:Subject


You will still have to set IPTC:ObjectName and XMP:Title separately.

You might also try using the command in FAQ #3 (https://exiftool.org/faq.html#Q3) so you can see the actual tag names (not tag descriptions), duplicate tags, and the groups they belong to.