ZeroDivisionError: float division by zero #192
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Version
img2pdf 0.5.1
from homebrewPlatform: macOS
I viewed all images and none are corrupted or of 0 size/length
Can you provide me with an image that exhibits this behaviour? Thanks!
Also, the division by zero error comes from one of your images which has:
I wonder what img2pdf should do when it encounters such an image. According to your debug output, it should be the fourth image matching
/Users/me/Downloads/62'/*.jpg
.Yes, that's correct. macOS Preview opens it fine and its Inspector says the DPI is 300 pixels/inch
imagemagick thinks it's OK too:
The image is NSFW. Can I email it to you?
Yes, my private email is josch@mister-muffin.de.
Thank you for helping with getting to the bottom of this!
Okay, I have an analysis for this issue. Here are the first 32 bytes of the problematic image:
This is the JFIF APP0 segment and the density unit can be found at offset 13 and is 1 which corresponds to dots per inch. The two bytes after that are 0x12c which is 300 in decimal and the X resolution. The two bytes after that are the Y resolution and set to zero. This is why your image is problematic.