Unintentionally added metadata fields

Started by banana123, April 11, 2024, 10:23:00 AM

Previous topic - Next topic

banana123

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!

StarGeek

From the EXIF Tags page
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 and making sure you are using exiftool Version 12.71 (Dec. 21, 2023) or higher.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

banana123

Quote from: StarGeek on April 11, 2024, 11:03:52 AMFrom the EXIF Tags page
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 and making sure you are using exiftool Version 12.71 (Dec. 21, 2023) or higher.


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


Phil Harvey

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

banana123

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?

StarGeek

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, 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, you would add it like any other parameters.  Using a couple of examples from the PyExiftool docs, 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, which is what the wrapper uses. Also see FAQ #29, "My options don't work in a -@ ARGFILE".
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

banana123

That worked great,
I used the "-api", "NoMandatory=1" inside the execute args list

Thanks!