hMatoba / Piexif

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

struct.error: ubyte format requires 0 <= number <= 255. #130

Open ZTFtrue opened 2 years ago

ZTFtrue commented 2 years ago

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

The GPS message maybe have an error. Other image tools don't show GPS messages. this is picture.

Now I use this, it worked for me.

if gps_is:
        try:
            gps_set = _dict_to_bytes(gps_ifd, "GPS", zeroth_length + exif_length)
            gps_bytes = b"".join(gps_set)
            gps_length = len(gps_bytes)
        except Exception as e:
            print('GPS error')
        finally:
            gps_bytes = b""
            gps_length = 0