hMatoba / Piexif

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

piexif.dump issue ***struct.error: ubyte format requires 0 <= number <= 255 #120

Open Mostafa-Nakhaei opened 2 years ago

Mostafa-Nakhaei commented 2 years ago

as simple as the following code, I get the error:

exif_dict = piexif.load(filename) exif_bytes = piexif.dump(exif_dict)

error I get: *** struct.error: ubyte format requires 0 <= number <= 255

Reason: exif_dict["GPS"][5] is 256 in my photo but the format enforces byte! I tried to evaluate the exif_dict["GPS"][5] to a tuple ( e.g. (256,) ) but the same issue persisted.

I use python 3.6