Fixes #414
This commit is contained in:
wiredfool 2013-11-20 17:03:46 -08:00
parent e4fe6ae7a3
commit cc5e8f0f6d

View File

@ -797,21 +797,22 @@ unpackI16N_I16(UINT8* out, const UINT8* in, int pixels){
static void static void
unpackI12_I16(UINT8* out, const UINT8* in, int pixels){ unpackI12_I16(UINT8* out, const UINT8* in, int pixels){
/* Fillorder 1/MSB -> LittleEndian /* Fillorder 1/MSB -> LittleEndian, for 12bit integer greyscale tiffs.
According to the spec: According to the TIFF spec:
FillOrder = 2 should be used only when BitsPerSample = 1 and FillOrder = 2 should be used only when BitsPerSample = 1 and
the data is either uncompressed or compressed using CCITT 1D the data is either uncompressed or compressed using CCITT 1D
or 2D compression, to avoid potentially ambigous situations. or 2D compression, to avoid potentially ambigous situations.
Yeah. I thought so. See how well people read the spec. Yeah. I thought so. We'll see how well people read the spec.
We've got several fillorder=2 modes in TiffImagePlugin.py
There's no spec I can find. It appears that the in storage
So, it appears that the layout is: 00 80 00 ... -> (128 , 0 layout is: 00 80 00 ... -> (128 , 0 ...). The samples are
...). The samples are stored in a single big bitian 12bit stored in a single big bitian 12bit block, but need to be
block, but need to be pulled out to little endian format to be pulled out to little endian format to be stored in a 2 byte
stored in a 2 byte int. int.
*/ */
int i; int i;
@ -1216,7 +1217,7 @@ static struct {
{"I;16L", "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;16B", "I;16N", 16, unpackI16N_I16B},
{"I;16", "I;12", 12, unpackI12_I16}, // {"I;16", "I;12", 12, unpackI12_I16}, // 12 bit Tiffs stored in 16bits.
{NULL} /* sentinel */ {NULL} /* sentinel */
}; };