mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-16 18:24:45 +03:00
Round TIFF DPI
This commit is contained in:
parent
9e5650914c
commit
634740cad8
|
@ -52,7 +52,6 @@ from numbers import Number, Rational
|
|||
|
||||
import io
|
||||
import itertools
|
||||
import math
|
||||
import os
|
||||
import struct
|
||||
import sys
|
||||
|
@ -1155,9 +1154,9 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
if xres and yres:
|
||||
resunit = self.tag_v2.get(RESOLUTION_UNIT, 1)
|
||||
if resunit == 2: # dots per inch
|
||||
self.info["dpi"] = int(math.ceil(xres)), int(math.ceil(yres))
|
||||
self.info["dpi"] = int(round(xres)), int(round(yres))
|
||||
elif resunit == 3: # dots per centimeter. convert to dpi
|
||||
self.info["dpi"] = int(math.ceil(xres * 2.54)), int(math.ceil(yres * 2.54))
|
||||
self.info["dpi"] = int(round(xres * 2.54)), int(round(yres * 2.54))
|
||||
else: # No absolute unit of measurement
|
||||
self.info["resolution"] = xres, yres
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user