mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-09 16:10:48 +03:00
Raise error if dimension is a string
This commit is contained in:
parent
152ed62b21
commit
9a977b975c
BIN
Tests/images/string_dimension.tiff
Normal file
BIN
Tests/images/string_dimension.tiff
Normal file
Binary file not shown.
|
@ -587,6 +587,11 @@ class TestFileTiff(PillowTestCase):
|
||||||
im.load()
|
im.load()
|
||||||
self.assertFalse(fp.closed)
|
self.assertFalse(fp.closed)
|
||||||
|
|
||||||
|
def test_string_dimension(self):
|
||||||
|
# Assert that an error is raised if one of the dimensions is a string
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
Image.open("Tests/images/string_dimension.tiff")
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(sys.platform.startswith("win32"), "Windows only")
|
@unittest.skipUnless(sys.platform.startswith("win32"), "Windows only")
|
||||||
class TestFileTiffW32(PillowTestCase):
|
class TestFileTiffW32(PillowTestCase):
|
||||||
|
|
|
@ -1239,8 +1239,8 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
print("- YCbCr subsampling:", self.tag.get(530))
|
print("- YCbCr subsampling:", self.tag.get(530))
|
||||||
|
|
||||||
# size
|
# size
|
||||||
xsize = self.tag_v2.get(IMAGEWIDTH)
|
xsize = int(self.tag_v2.get(IMAGEWIDTH))
|
||||||
ysize = self.tag_v2.get(IMAGELENGTH)
|
ysize = int(self.tag_v2.get(IMAGELENGTH))
|
||||||
self._size = xsize, ysize
|
self._size = xsize, ysize
|
||||||
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user