mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
Favour integer operations when calculating DPI
This commit is contained in:
parent
8045ecceef
commit
dab5721c34
|
@ -132,7 +132,7 @@ def _res_to_dpi(num, denom, exp):
|
|||
calculated as (num / denom) * 10^exp and stored in dots per meter,
|
||||
to floating-point dots per inch."""
|
||||
if denom != 0:
|
||||
return num / denom * (10 ** exp) * 0.0254
|
||||
return (254 * num * (10 ** exp)) / (10000 * denom)
|
||||
|
||||
|
||||
def _parse_jp2_header(fp):
|
||||
|
|
Loading…
Reference in New Issue
Block a user