Python Forum

Full Version: Strange EXIF data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello
I have digitalized some picture some years ago.
The scanner has put a date in the Exif Field DateTimeDigitized
I would like to remove this date an creat a new Exif Tag with DateTime.
I am able to creat the new date.

But the DateTimeDigitized seem's strange.
The Id of DateTimeDigitized should be 36868

If I display the image EXIF in python with the code below

def display_exif_data(image_path):
    with open(image_path, 'rb') as image_file:
        tags = exifread.process_file(image_file)
        for tag, value in tags.items():
                print(f"{tag}: {value}")
I get :
Output:
Image Make: Nikon Image Model: LS-5000 Image Software: VueScan 9 x64 (9.4.25) Image ExifOffset: 195 EXIF DateTimeDigitized: 2014:02:26 21:33:04
If I add a new Tag (DateTime : 306 for exemple) with the following code
def add_Exif(image_path, id_Exif, data):
    img = Image.open(image_path)
    exif = img.getexif()
    exif[id_Exif] = data
    img.save(image_path, exif=exif)
It works
Output:
Image Make: Nikon Image Model: LS-5000 Image Software: VueScan 9 x64 (9.4.25) Image DateTime: 1995:07:01 00:00:00 Image ExifOffset: 240 EXIF DateTimeDigitized: 2014:02:26 21:33:04
With the following code I can remove the Tag
def remove_exif_tag_old(image_path, tag):
    with open(image_path, 'rb') as image_file:
        tags = exifread.process_file(image_file)
    if tag in tags:
        del tags[tag]
    with open(image_path, 'wb') as image_file:
        for tag_key, tag_value in tags.items():
            image_file.write(bytes(tag_value))
But I can't remove the DateTimeDigitized '36868'. ???
If I try to add this tag 36868 with another value I get :
Output:
Image Make: Nikon Image Model: LS-5000 Image Software: VueScan 9 x64 (9.4.25) Image DateTime: 1995:07:01 00:00:00 Image ExifOffset: 240 Image DateTimeDigitized: 1995:07:01 00:00:00 EXIF DateTimeDigitized: 2014:02:26 21:33:04
If reading till this point thanks ;-)

=> My question is what is this Filed "EXIF DateTimeDigitized" compare to "Image DateTimeDigitized" and how to remove it?

Thanks
Perhaps a Q&A from 5 years ago will shed some light.

https://exiftool.org/forum/index.php?topic=10875.0

Paul