ExifTool Forum

General => Metadata => Topic started by: banana123 on April 11, 2024, 10:23:00 AM

Title: Unintentionally added metadata fields
Post by: banana123 on April 11, 2024, 10:23:00 AM
Hi,
when trying to add date fields to an image without them, i noticed exiftool adds more fields i didnt mean to add.
In the attached picture you can see all the added fields,
I added 'EXIF:DateTimeOriginal', 'EXIF:CreateDate', "EXIF:ModifyDate",
the rest of the fields added by exiftool..
Any good reason?
Thanks!
Title: Re: Unintentionally added metadata fields
Post by: StarGeek on April 11, 2024, 11:03:52 AM
From the EXIF Tags page (https://exiftool.org/TagNames/EXIF.html)
QuoteMandatory tags (indicated by a colon after the Writable type) may be added automatically with default values when creating a new IFD, and the IFD is removed automatically when deleting tags if only default-valued mandatory tags remain.

Certain tags are required by the EXIF spec and exiftool will add them automatically. You can suppress these tags by adding the -api NoMandatory option (https://exiftool.org/ExifTool.html#NoMandatory) and making sure you are using exiftool Version 12.71 (Dec. 21, 2023) (https://exiftool.org/history.html#v12.71) or higher.
Title: Re: Unintentionally added metadata fields
Post by: banana123 on April 14, 2024, 02:45:33 AM
Quote from: StarGeek on April 11, 2024, 11:03:52 AMFrom the EXIF Tags page (https://exiftool.org/TagNames/EXIF.html)
QuoteMandatory tags (indicated by a colon after the Writable type) may be added automatically with default values when creating a new IFD, and the IFD is removed automatically when deleting tags if only default-valued mandatory tags remain.

Certain tags are required by the EXIF spec and exiftool will add them automatically. You can suppress these tags by adding the -api NoMandatory option (https://exiftool.org/ExifTool.html#NoMandatory) and making sure you are using exiftool Version 12.71 (Dec. 21, 2023) (https://exiftool.org/history.html#v12.71) or higher.


Great, thanks!!
Do you support 'exiftool' python package (PyExifTool)?
Will it work with it?

Title: Re: Unintentionally added metadata fields
Post by: Phil Harvey on April 14, 2024, 06:56:43 AM
PyExifTool is supported by a different author, however even if it doesn't support additional command-line options, you should be able to set API options in an ExifTool config file.

- Phil
Title: Re: Unintentionally added metadata fields
Post by: banana123 on April 14, 2024, 08:27:33 AM
Tried to look on the example config file in the exiftool dir,
i only want to add the -api noMandatory,
could you please give me an example config file with that line?
Title: Re: Unintentionally added metadata fields
Post by: StarGeek on April 14, 2024, 10:50:43 AM
Near the bottom of the example config is the
# Specify default ExifTool API options
section.  If all you need is to add -api NoMandatory option (https://exiftool.org/ExifTool.html#NoMandatory), then your config file would look like this

# Specify default ExifTool API options
# (see the Options function documentation for available options)
%Image::ExifTool::UserDefined::Options = (
    NoMandatory => 1,
);

If you already have a more complete config file, you would just add the middle line to the API options section.

But with PYExiftool (https://github.com/sylikc/pyexiftool), you would add it like any other parameters.  Using a couple of examples from the PyExiftool docs (https://sylikc.github.io/pyexiftool/examples.html#input-parameters), it would probably be

execute("-DateTimeOriginal=2021:01:02 03:04:05", "-api","NoMandatory=1", "rose.jpg")or
execute(*["-api","NoMandatory=1","-P", "-DateTimeOriginal=2021:01:02 03:04:05", "-MakerNotes=", "spaces in filename.jpg"])
I don't know Python, so I can't be 100% sure, but it looks like it's basically setting each parameter separately, as would be needed for use with the -stay_open option (https://exiftool.org/exiftool_pod.html#stay_open-FLAG), which is what the wrapper uses. Also see FAQ #29, "My options don't work in a -@ ARGFILE" (https://exiftool.org/faq.html#Q29).
Title: Re: Unintentionally added metadata fields
Post by: banana123 on April 15, 2024, 03:24:00 AM
That worked great,
I used the "-api", "NoMandatory=1" inside the execute args list

Thanks!