Skip to content

EXIF pointer tags cause other tag changes to be reset? #6663

Answered by radarhere
FRbrt asked this question in Q&A
Discussion options

You must be logged in to vote

I feel like you're halfway to figuring out the solution from the code.

In terms of the specification, the problem is that while DateTime is a top-level tag, DateTimeOriginal and DateTimeDigitized are not. See https://www.awaresystems.be/imaging/tiff/tifftags/exififd.html, or look at the Group column of https://exiftool.org/TagNames/EXIF.html.

It's not that your values are being overwritten as such. It's that you are setting them in the wrong place.

The following code should save those values correctly.

from PIL import Image
with Image.open(imageFilePath) as image:
    imgExif = image.getexif()

    imgExif[0x0132] = '2022:10:05 17:00:30'   # DateTime

    exif_ifd = imgExif.get_ifd(0x8769)…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@FRbrt
Comment options

Answer selected by FRbrt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants