-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
DPI is rounded wrong by 1 #3323
Comments
The dpi was set to round up in https://github.com/python-pillow/Pillow/pull/745/files#diff-3b431a4460b330394080ef7c1391f9e5R101. So this was deliberate, rather than being accidental, and has been part of Pillow for four years. There is a general reluctance to change established behaviour. Can you provide a compelling reason why the rounding should change? |
I won't self-claim it's "compelling" but here is my thought.
In my personal use case, I use pillow to batch convert image format, so I want to keep all metadata as pristine as before. (Kinda off-topic, but I currently just call external program ( |
I've created PR #3709, which resolves this. |
Thank you! |
What did you do?
Take this image
test_image.zip
Its info according to
magick
:As you can see, the PPC is 177.17, which converts to 177.17*2.54=450.0118 DPI
What did you expect to happen?
When use img.info["dpi"], it should show (450,450)
What actually happened?
It shows (451,451)
What versions of Pillow and Python are you using?
Python 3.6.5
Pillow 5.2.0
Repro code
The text was updated successfully, but these errors were encountered: