ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: ginetto on November 21, 2024, 06:13:41 AM

Title: CLI vs API mismatch behaviour
Post by: ginetto on November 21, 2024, 06:13:41 AM
just open a new possible bug (or lack of deep knowledge of the tool)
https://github.com/exiftool/exiftool/issues/293
 (https://github.com/exiftool/exiftool/issues/293)
here a resume:
API behaviour (e.g. accepted parameter format) do not follow the same rule as CLI

To Reproduce
probably my lack of knowledge of the use of the API. I'm updating tags in a Tiff (COG formatted) and most of tags are updated correctly but some are ignored:
I did manually a test and this is the mismatch

In [10]: with ExifTool() as et:
    ...:     et.execute('-Exif:GPSLatitude="41 55 24"', "./notag_cog.tif")    <--- try to update the value via API
    ...:

In [11]: !exiv2 -pt  notag_cog.tif| grep -i GPSLatitude
Warning: Directory Image3 has an unexpected next pointer; ignored.
Exif.GPSInfo.GPSLatitudeRef                  Ascii       2  North
Exif.GPSInfo.GPSLatitude                     Rational    3  40deg 54' 23"    <--- remain the old value

In [12]: !exiftool -Exif:GPSLatitude="41 55 24"  notag_cog.tif                <--- update it via CLI with same parameter as API
    1 image files updated

In [13]: !exiv2 -pt  notag_cog.tif| grep -i GPSLatitude
    ...:
Warning: Directory Image3 has an unexpected next pointer; ignored.
Exif.GPSInfo.GPSLatitudeRef                  Ascii       2  North
Exif.GPSInfo.GPSLatitude                     Rational    3  41deg 55' 24"        <--- and via CLI it works

I tried to change from "41 55 24"" to "41deg 55min 24sec" but behaviour does not change.

p.s. sorry to use exiv2, just because allow me to write less parameters ;)

Expected behavior
API and CLI would be fine to have the same syntax management

Platform:
Ubuntu 24.04.1 LTS
0.27.6 (installed via apt)
Title: Re: CLI vs API mismatch behaviour
Post by: StarGeek on November 21, 2024, 11:05:53 AM
et.execute isn't an exiftool API command. See the Image::ExifTool Perl Library Module (https://exiftool.org/ExifTool.html).

It sounds like you're using PyExifTool (https://github.com/sylikc/pyexiftool). This was created by a 3rd party and isn't supported by the author of exiftool.

I did find this StackOverflow answer (https://stackoverflow.com/questions/50938662/) which seems like it might apply to your problem.