mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-13 09:33:21 +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,
|
calculated as (num / denom) * 10^exp and stored in dots per meter,
|
||||||
to floating-point dots per inch."""
|
to floating-point dots per inch."""
|
||||||
if denom != 0:
|
if denom != 0:
|
||||||
return num / denom * (10 ** exp) * 0.0254
|
return (254 * num * (10 ** exp)) / (10000 * denom)
|
||||||
|
|
||||||
|
|
||||||
def _parse_jp2_header(fp):
|
def _parse_jp2_header(fp):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user