Raise ValueError when WMF inch is zero by radarhere · Pull Request #8600 · python-pillow/Pillow

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

ZeroDivisionError occurs when calling Image.open

2 participants

@radarhere @hugovk