Skip to content

Raise ValueError when WMF inch is zero#8600

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:inch
Dec 18, 2024
Merged

Raise ValueError when WMF inch is zero#8600
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:inch

Conversation

@radarhere
Copy link
Copy Markdown
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
@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
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
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