mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-10-04 11:26:44 -04:00
TMI #163 Support for TIFF containing signed integral other than 16 bit.
This commit is contained in:
@@ -521,10 +521,16 @@ public class TIFFImageReader extends ImageReaderBase {
|
|||||||
case TIFFBaseline.SAMPLEFORMAT_UINT:
|
case TIFFBaseline.SAMPLEFORMAT_UINT:
|
||||||
return bitsPerSample <= 8 ? DataBuffer.TYPE_BYTE : bitsPerSample <= 16 ? DataBuffer.TYPE_USHORT : DataBuffer.TYPE_INT;
|
return bitsPerSample <= 8 ? DataBuffer.TYPE_BYTE : bitsPerSample <= 16 ? DataBuffer.TYPE_USHORT : DataBuffer.TYPE_INT;
|
||||||
case TIFFExtension.SAMPLEFORMAT_INT:
|
case TIFFExtension.SAMPLEFORMAT_INT:
|
||||||
if (bitsPerSample == 16) {
|
switch (bitsPerSample) {
|
||||||
return DataBuffer.TYPE_SHORT;
|
case 8:
|
||||||
|
return DataBuffer.TYPE_BYTE;
|
||||||
|
case 16:
|
||||||
|
return DataBuffer.TYPE_SHORT;
|
||||||
|
case 32:
|
||||||
|
return DataBuffer.TYPE_INT;
|
||||||
}
|
}
|
||||||
throw new IIOException("Unsupported BitsPerSample for SampleFormat 2/Signed Integer (expected 16): " + bitsPerSample);
|
|
||||||
|
throw new IIOException("Unsupported BitsPerSample for SampleFormat 2/Signed Integer (expected 8/16/32): " + bitsPerSample);
|
||||||
case TIFFExtension.SAMPLEFORMAT_FP:
|
case TIFFExtension.SAMPLEFORMAT_FP:
|
||||||
throw new IIOException("Unsupported TIFF SampleFormat: 3 (Floating point)");
|
throw new IIOException("Unsupported TIFF SampleFormat: 3 (Floating point)");
|
||||||
case TIFFExtension.SAMPLEFORMAT_UNDEFINED:
|
case TIFFExtension.SAMPLEFORMAT_UNDEFINED:
|
||||||
|
@@ -82,6 +82,7 @@ public class TIFFImageReaderTest extends ImageReaderAbstractTest<TIFFImageReader
|
|||||||
new TestData(getClassLoaderResource("/tiff/cmyk_jpeg_no_profile.tif"), new Dimension(150, 63)), // CMYK, JPEG compressed, no ICC profile
|
new TestData(getClassLoaderResource("/tiff/cmyk_jpeg_no_profile.tif"), new Dimension(150, 63)), // CMYK, JPEG compressed, no ICC profile
|
||||||
new TestData(getClassLoaderResource("/tiff/cmyk_jpeg.tif"), new Dimension(100, 100)), // CMYK, JPEG compressed, with ICC profile
|
new TestData(getClassLoaderResource("/tiff/cmyk_jpeg.tif"), new Dimension(100, 100)), // CMYK, JPEG compressed, with ICC profile
|
||||||
new TestData(getClassLoaderResource("/tiff/grayscale-alpha.tiff"), new Dimension(248, 351)), // Gray + unassociated alpha
|
new TestData(getClassLoaderResource("/tiff/grayscale-alpha.tiff"), new Dimension(248, 351)), // Gray + unassociated alpha
|
||||||
|
new TestData(getClassLoaderResource("/tiff/signed-integral-8bit.tif"), new Dimension(439, 167)), // 8 bit gray, *signed* integral
|
||||||
// CCITT
|
// CCITT
|
||||||
new TestData(getClassLoaderResource("/tiff/ccitt/group3_1d.tif"), new Dimension(6, 4)), // B/W, CCITT T4 1D
|
new TestData(getClassLoaderResource("/tiff/ccitt/group3_1d.tif"), new Dimension(6, 4)), // B/W, CCITT T4 1D
|
||||||
new TestData(getClassLoaderResource("/tiff/ccitt/group3_1d_fill.tif"), new Dimension(6, 4)), // B/W, CCITT T4 1D
|
new TestData(getClassLoaderResource("/tiff/ccitt/group3_1d_fill.tif"), new Dimension(6, 4)), // B/W, CCITT T4 1D
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user