Add basic support for TIFF 16-bit signed integer pixels (mode I;16S).

Only small additions needed to access the pixel data as numpy arrays were made.
Code to convert to other pixel types such as 32-bit integers are not included.
This commit is contained in:
Tom Goddard 2017-06-13 18:24:07 -07:00
parent 95eee4315d
commit 5a3bf84804
4 changed files with 6 additions and 1 deletions

View File

@ -227,6 +227,7 @@ ImagingAccessInit()
ADD("I;16", line_16, get_pixel_16L, put_pixel_16L);
ADD("I;16L", line_16, get_pixel_16L, put_pixel_16L);
ADD("I;16B", line_16, get_pixel_16B, put_pixel_16B);
ADD("I;16S", line_16, get_pixel_16L, put_pixel_16L);
ADD("I;32L", line_32, get_pixel_32L, put_pixel_32L);
ADD("I;32B", line_32, get_pixel_32B, put_pixel_32B);
ADD("F", line_32, get_pixel_32, put_pixel_32);

View File

@ -613,6 +613,7 @@ static struct {
{"I;16", "I;16", 16, copy2},
{"I;16B", "I;16B", 16, copy2},
{"I;16L", "I;16L", 16, copy2},
{"I;16S", "I;16S", 16, copy2},
{"I;16", "I;16N", 16, packI16N_I16}, // LibTiff native->image endian.
{"I;16L", "I;16N", 16, packI16N_I16},
{"I;16B", "I;16N", 16, packI16N_I16B},

View File

@ -117,7 +117,8 @@ ImagingNewPrologueSubtype(const char *mode, int xsize, int ysize,
im->type = IMAGING_TYPE_INT32;
} else if (strcmp(mode, "I;16") == 0 || strcmp(mode, "I;16L") == 0 \
|| strcmp(mode, "I;16B") == 0 || strcmp(mode, "I;16N") == 0) {
|| strcmp(mode, "I;16B") == 0 || strcmp(mode, "I;16N") == 0 \
|| strcmp(mode, "I;16S") == 0) {
/* EXPERIMENTAL */
/* 16-bit raw integer images */
im->bands = 1;

View File

@ -1349,10 +1349,12 @@ static struct {
{"I;16", "I;16", 16, copy2},
{"I;16B", "I;16B", 16, copy2},
{"I;16L", "I;16L", 16, copy2},
{"I;16S", "I;16S", 16, copy2},
{"I;16", "I;16N", 16, unpackI16N_I16}, // LibTiff native->image endian.
{"I;16L", "I;16N", 16, unpackI16N_I16}, // LibTiff native->image endian.
{"I;16B", "I;16N", 16, unpackI16N_I16B},
// {"I;16S", "I;16N", 16, unpackI16N_I16}, // LibTiff native->image endian.
{"I;16", "I;12", 12, unpackI12_I16}, // 12 bit Tiffs stored in 16bits.