Skip to content

Conversation

@radarhere
Copy link
Member

Resolves #8597

The issue is concerned that a ZeroDivisionError may be raised if self._inch is zero.

size = (
(x1 - x0) * self.info["dpi"] // self._inch,
(y1 - y0) * self.info["dpi"] // self._inch,
)

This raises a ValueError of "Invalid inch" first.

@hugovk hugovk merged commit cbc55c4 into python-pillow:main Dec 18, 2024
49 checks passed
@radarhere radarhere deleted the inch branch December 18, 2024 07:55
eyedav pushed a commit to eyedav/Pillow that referenced this pull request Jul 19, 2025
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

Successfully merging this pull request may close these issues.

ZeroDivisionError occurs when calling Image.open

2 participants