hMatoba / Piexif

Exif manipulation with pure python script.
MIT License
367 stars 81 forks source link

piexif.dump() dump same bytes even the exif_dicts are different #80

Open allennjusa opened 5 years ago

allennjusa commented 5 years ago

I used below code to change the exif, but no matter what I values are added, the dumped value exif_bytes is always same: b'Exif\x00\x00MM\x00*\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00'

img = Image.open(file_path)
exif_dict = piexif.load(img.info['exif'])
exif_dict['1st']['piexif.ImageIFD.Make'] = get_random_letters(5)
exif_dict['1st']['piexif.ImageIFD.Software'] = get_random_letters(5)
exif_bytes = piexif.dump(exif_dict)
img.save(file_path, "jpeg", exif=exif_bytes)