exif
exif copied to clipboard
ValueError: byte offset exceeds length of segment
Hi, i try to open file and read exif of the pics but i get this traceback
Python 3.8.2 (default, Mar 13 2020, 10:14:16)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from exif import Image
>>> with open("./nc/IMG_3705.jpg", 'rb') as image_file:
... my_image = Image(image_file)
... print(my_image.has_exif)
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/home/adrien/.local/lib/python3.8/site-packages/exif/_image.py", line 67, in __init__
self._parse_segments(img_hex)
File "/home/adrien/.local/lib/python3.8/site-packages/exif/_image.py", line 53, in _parse_segments
self._segments['APP1'] = App1MetaData(img_hex[app1_start_index:cursor])
File "/home/adrien/.local/lib/python3.8/site-packages/exif/_app1_metadata.py", line 232, in __init__
self._unpack_ifd_tags()
File "/home/adrien/.local/lib/python3.8/site-packages/exif/_app1_metadata.py", line 137, in _unpack_ifd_tags
num_ifd_tags = int(self._segment_hex.read(cursor, 2), 16)
File "/home/adrien/.local/lib/python3.8/site-packages/exif/_hex_interface.py", line 104, in read
raise ValueError("byte offset exceeds length of segment")
ValueError: byte offset exceeds length of segment
The point is the image is kind of big 5.5MB
Hello, @beudbeud! Thank you for bringing this to my attention. Could you please provide a sample image that demonstrates this issue so I can recreate it? I haven't been able to reproduce the behavior with images I've tried.