TIFF sample format table

This commit is contained in:
Junxiao Shi 2024-06-01 14:56:34 +00:00
parent 90840ae38c
commit 03df35777c
2 changed files with 8 additions and 13 deletions

View File

@ -60,6 +60,7 @@ from ._deprecate import deprecate
from .TiffTags import TYPES
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG) # XXX hack202406
# Set these to true to force use of libtiff for reading or writing.
READ_LIBTIFF = False
@ -182,11 +183,11 @@ OPEN_INFO = {
(II, 1, (1,), 1, (12,), ()): ("I;16", "I;12"),
(II, 0, (1,), 1, (16,), ()): ("I;16", "I;16"),
(II, 1, (1,), 1, (16,), ()): ("I;16", "I;16"),
(II, 1, (1,), 1, (16, 16), (0,)): ("I;16", "I;16"),
(II, 1, (1, 1), 1, (16, 16), (0,)): ("I;16", "I;16"),
(
II,
1,
(1,),
(1, 1, 1),
1,
(16, 16, 16),
(
@ -197,7 +198,7 @@ OPEN_INFO = {
(
II,
1,
(1,),
(1, 1, 1, 1),
1,
(16, 16, 16, 16),
(
@ -209,7 +210,7 @@ OPEN_INFO = {
(
II,
1,
(1,),
(1, 1, 1, 1, 1),
1,
(16, 16, 16, 16, 16),
(
@ -1416,13 +1417,7 @@ class TiffImageFile(ImageFile.ImageFile):
logger.debug("- size: %s", self.size)
sample_format = self.tag_v2.get(SAMPLEFORMAT, (1,))
if len(sample_format) > 1 and max(sample_format) == min(sample_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.
sample_format = (1,)
logger.debug("- sample_format: %s", sample_format)
bps_tuple = self.tag_v2.get(BITSPERSAMPLE, (1,))
extra_tuple = self.tag_v2.get(EXTRASAMPLES, ())

View File

@ -94,8 +94,8 @@
#include <math.h>
/* Configuration stuff. Feel free to undef things you don't need. */
#define WITH_IMAGECHOPS /* ImageChops support */
#define WITH_IMAGEDRAW /* ImageDraw support */
#define WITH_IMAGECHOPS /* ImageChops support */
#define WITH_IMAGEDRAW /* ImageDraw support */
// XXX hack202406 disable unmodified code path
// #define WITH_MAPPING /* use memory mapping to read some file formats */
#define WITH_IMAGEPATH /* ImagePath stuff */