mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-04 04:20:10 +03:00
TIFF sample format table
This commit is contained in:
parent
4e958509be
commit
fb49794d6e
|
@ -60,6 +60,7 @@ from ._deprecate import deprecate
|
||||||
from .TiffTags import TYPES
|
from .TiffTags import TYPES
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
logger.setLevel(logging.DEBUG) # XXX hack202406
|
||||||
|
|
||||||
# Set these to true to force use of libtiff for reading or writing.
|
# Set these to true to force use of libtiff for reading or writing.
|
||||||
READ_LIBTIFF = False
|
READ_LIBTIFF = False
|
||||||
|
@ -182,6 +183,43 @@ OPEN_INFO = {
|
||||||
(II, 1, (1,), 1, (12,), ()): ("I;16", "I;12"),
|
(II, 1, (1,), 1, (12,), ()): ("I;16", "I;12"),
|
||||||
(II, 0, (1,), 1, (16,), ()): ("I;16", "I;16"),
|
(II, 0, (1,), 1, (16,), ()): ("I;16", "I;16"),
|
||||||
(II, 1, (1,), 1, (16,), ()): ("I;16", "I;16"),
|
(II, 1, (1,), 1, (16,), ()): ("I;16", "I;16"),
|
||||||
|
(II, 1, (1, 1), 1, (16, 16), (0,)): ("I;16", "I;16"),
|
||||||
|
(
|
||||||
|
II,
|
||||||
|
1,
|
||||||
|
(1, 1, 1),
|
||||||
|
1,
|
||||||
|
(16, 16, 16),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
): ("I;16", "I;16"),
|
||||||
|
(
|
||||||
|
II,
|
||||||
|
1,
|
||||||
|
(1, 1, 1, 1),
|
||||||
|
1,
|
||||||
|
(16, 16, 16, 16),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
): ("I;16", "I;16"),
|
||||||
|
(
|
||||||
|
II,
|
||||||
|
1,
|
||||||
|
(1, 1, 1, 1, 1),
|
||||||
|
1,
|
||||||
|
(16, 16, 16, 16, 16),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
): ("I;16", "I;16"),
|
||||||
(MM, 1, (1,), 1, (16,), ()): ("I;16B", "I;16B"),
|
(MM, 1, (1,), 1, (16,), ()): ("I;16B", "I;16B"),
|
||||||
(II, 1, (1,), 2, (16,), ()): ("I;16", "I;16R"),
|
(II, 1, (1,), 2, (16,), ()): ("I;16", "I;16R"),
|
||||||
(II, 1, (2,), 1, (16,), ()): ("I", "I;16S"),
|
(II, 1, (2,), 1, (16,), ()): ("I", "I;16S"),
|
||||||
|
@ -1379,13 +1417,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
logger.debug("- size: %s", self.size)
|
logger.debug("- size: %s", self.size)
|
||||||
|
|
||||||
sample_format = self.tag_v2.get(SAMPLEFORMAT, (1,))
|
sample_format = self.tag_v2.get(SAMPLEFORMAT, (1,))
|
||||||
if len(sample_format) > 1 and max(sample_format) == min(sample_format) == 1:
|
logger.debug("- sample_format: %s", sample_format)
|
||||||
# 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.
|
|
||||||
sample_format = (1,)
|
|
||||||
|
|
||||||
bps_tuple = self.tag_v2.get(BITSPERSAMPLE, (1,))
|
bps_tuple = self.tag_v2.get(BITSPERSAMPLE, (1,))
|
||||||
extra_tuple = self.tag_v2.get(EXTRASAMPLES, ())
|
extra_tuple = self.tag_v2.get(EXTRASAMPLES, ())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user