mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 09:26:16 +03:00
allow integer image resolution as well as rational
This commit is contained in:
parent
5ca04bb728
commit
af94b45cbc
|
@ -723,6 +723,10 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
xres = getscalar(X_RESOLUTION, (1, 1))
|
||||
yres = getscalar(Y_RESOLUTION, (1, 1))
|
||||
|
||||
if xres and not isinstance(xres, tuple):
|
||||
xres = (xres, 1.)
|
||||
if yres and not isinstance(yres, tuple):
|
||||
yres = (yres, 1.)
|
||||
if xres and yres:
|
||||
xres = xres[0] / (xres[1] or 1)
|
||||
yres = yres[0] / (yres[1] or 1)
|
||||
|
|
|
@ -70,3 +70,4 @@ def test_xyres_tiff():
|
|||
im.tag.tags[X_RESOLUTION] = (72,)
|
||||
im.tag.tags[Y_RESOLUTION] = (72,)
|
||||
im._setup()
|
||||
im.info['dpi'] == (72., 72.)
|
||||
|
|
Loading…
Reference in New Issue
Block a user