Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

piexif.load() with error: unpack requires a buffer of 2 bytes #129

Open
wuxiangchao opened this issue Jan 21, 2022 · 1 comment
Open

piexif.load() with error: unpack requires a buffer of 2 bytes #129

wuxiangchao opened this issue Jan 21, 2022 · 1 comment

Comments

@wuxiangchao
Copy link

fix method: add code into _load.py at line 108:
if len(self.tiftag[pointer: pointer+2]) != 2: return ifd_dict

@nandoflorestan
Copy link

Here is an image that will cause this issue:
https://read.nando.audio/images/warsaw-veturilo.jpg

The above solution does fix it.

And here is the stacktrace.

TaskError - taskid:scale_images:../output/images/warsaw-veturilo.jpg
PythonAction Error
Traceback (most recent call last):
File "/home/nando/ythn/nando/read.nando.audio/.venv/lib/python3.10/site-packages/doit/action.py", line 461, in execute
returned_value = self.py_callable(*self.args, **kwargs)
File "/home/nando/ythn/nando/read.nando.audio/.venv/lib/python3.10/site-packages/nikola/plugins/task/scale_images.py", line 69, in process_image
self.resize_image(
File "/home/nando/ythn/nando/read.nando.audio/.venv/lib/python3.10/site-packages/nikola/image_processing.py", line 117, in resize_image
exif = piexif.load(_im.info["exif"])
File "/home/nando/ythn/nando/read.nando.audio/.venv/lib/python3.10/site-packages/piexif/_load.py", line 49, in load
exif_dict["Interop"] = exifReader.get_ifd_dict(pointer, "Interop")
File "/home/nando/ythn/nando/read.nando.audio/.venv/lib/python3.10/site-packages/piexif/_load.py", line 108, in get_ifd_dict
tag_count = struct.unpack(self.endian_mark + "H",
struct.error: unpack requires a buffer of 2 bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants