Disable the -n for pyexiftool such that fields like LensID are formatted for human reading

23 Views Asked by At

I use this code to read a directory with camera raw files

with exiftool.ExifToolHelper(logger=logging.getLogger(__name__)) as et:
    metadata = et.get_metadata(config["files"]["PictureDirectory"], params=SELECTED_FIELDS)

I cannot find how I can pass something like

#exiftool.ExifToolHelper.__init__(True, True, True, common_args=['-G'])

to override the defalt -n option.

Any help is appreciated.

I did not find out how to pass the common_args=['-G'] to override he default -n

1

There are 1 best solutions below

0
StarGeek On

The -n option cannot be overridden, so you can't exclude a single tag when extracting all data. It can be activated on a per tag basis by appending a hash tag to the end if a tag name e.g -TAG#, but that requires listing only specific tags, not all of them.

To override PYExiftool's default use of -n, see the FAQ under "Ways to make the ouptut match"

  • Disable print conversion and group name in PyExifTool:

import exiftool
with exiftool.ExifTool(common_args=None) as et:
print(et.execute("-JFIF:all", "rose.jpg"))