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

Convert DPI to ints when saving as JPEG #2102

Merged
merged 1 commit into from
Sep 22, 2016

Conversation

radarhere
Copy link
Member

Fixes #2077. Alternative to PR #2084.

Uses the test suggested in the issue.

@@ -593,7 +593,7 @@ def _save(im, fp, filename):

info = im.encoderinfo

dpi = info.get("dpi", (0, 0))
dpi = [int(x) for x in info.get("dpi", (0, 0))]
Copy link
Contributor

@arjennienhuis arjennienhuis Sep 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would round to nearest integer.

Ideally it would round to the nearest integer dpi or the nearest integer "dot per centimeter" whatever is closest.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@radarhere I wouldn't worry about meters/cm, but rounding seems reasonable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the rounding to the nearest integer that I'm already doing? Apologies if confused.

Copy link
Member

@wiredfool wiredfool Sep 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> int(3.9)
3
>>> int(round(3.9))
4

<aside> what a lovely bikeshed we've got here </aside>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wiredfool thanks. updated the PR.

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.

None yet

3 participants