mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Merge pull request #1467 from wiredfool/sampleformat
Flatten sampleformat to initial value, fixes #1466
This commit is contained in:
commit
23631302a9
|
@ -180,8 +180,6 @@ OPEN_INFO = {
|
||||||
(MM, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"),
|
(MM, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"),
|
||||||
(II, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10
|
(II, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10
|
||||||
(MM, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10
|
(MM, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10
|
||||||
(II, 2, (1, 1, 1, 1), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBA"), # OSX Grab
|
|
||||||
(MM, 2, (1, 1, 1, 1), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBA"), # OSX Grab
|
|
||||||
(II, 3, (1,), 1, (1,), ()): ("P", "P;1"),
|
(II, 3, (1,), 1, (1,), ()): ("P", "P;1"),
|
||||||
(MM, 3, (1,), 1, (1,), ()): ("P", "P;1"),
|
(MM, 3, (1,), 1, (1,), ()): ("P", "P;1"),
|
||||||
(II, 3, (1,), 2, (1,), ()): ("P", "P;1R"),
|
(II, 3, (1,), 2, (1,), ()): ("P", "P;1R"),
|
||||||
|
@ -967,6 +965,13 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
print("- size:", self.size)
|
print("- size:", self.size)
|
||||||
|
|
||||||
format = self.tag_v2.get(SAMPLEFORMAT, (1,))
|
format = self.tag_v2.get(SAMPLEFORMAT, (1,))
|
||||||
|
if len(format) > 1 and max(format) == min(format) == 1:
|
||||||
|
# SAMPLEFORMAT is properly per band, so an RGB image will
|
||||||
|
# be (1,1,1). But, we don't support per band pixel types,
|
||||||
|
# and anything more than one band is a uint8. So, just
|
||||||
|
# take the first element. Revisit this if adding support
|
||||||
|
# for more exotic images.
|
||||||
|
format = (1,)
|
||||||
|
|
||||||
# mode: check photometric interpretation and bits per pixel
|
# mode: check photometric interpretation and bits per pixel
|
||||||
key = (
|
key = (
|
||||||
|
|
BIN
Tests/images/copyleft.tiff
Normal file
BIN
Tests/images/copyleft.tiff
Normal file
Binary file not shown.
|
@ -70,6 +70,11 @@ class TestFileTiff(PillowTestCase):
|
||||||
])
|
])
|
||||||
im.load()
|
im.load()
|
||||||
|
|
||||||
|
def test_sampleformat(self):
|
||||||
|
# https://github.com/python-pillow/Pillow/issues/1466
|
||||||
|
im = Image.open("Tests/images/copyleft.tiff")
|
||||||
|
self.assertEqual(im.mode, 'RGB')
|
||||||
|
|
||||||
def test_xyres_tiff(self):
|
def test_xyres_tiff(self):
|
||||||
from PIL.TiffImagePlugin import X_RESOLUTION, Y_RESOLUTION
|
from PIL.TiffImagePlugin import X_RESOLUTION, Y_RESOLUTION
|
||||||
filename = "Tests/images/pil168.tif"
|
filename = "Tests/images/pil168.tif"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user