mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-04 03:55:28 -04:00
Fix for #455: Ignore profiles PhotometricInterpretation MinIsWhite with 1bit/pixel
This commit is contained in:
parent
5e3229c9b7
commit
cbaa0dc688
@ -468,7 +468,7 @@ public final class TIFFImageReader extends ImageReaderBase {
|
|||||||
// We need special case to preserve WhiteIsZero for CCITT 1 bit encodings
|
// We need special case to preserve WhiteIsZero for CCITT 1 bit encodings
|
||||||
// as some software will treat black/white runs as-is, regardless of photometric.
|
// as some software will treat black/white runs as-is, regardless of photometric.
|
||||||
// Special handling is also in the normalizeColor method
|
// Special handling is also in the normalizeColor method
|
||||||
if (profile == null && significantSamples == 1 && bitsPerSample == 1) {
|
if (significantSamples == 1 && bitsPerSample == 1) {
|
||||||
byte[] lut = new byte[] {-1, 0};
|
byte[] lut = new byte[] {-1, 0};
|
||||||
return ImageTypeSpecifier.createIndexed(lut, lut, lut, null, bitsPerSample, dataType);
|
return ImageTypeSpecifier.createIndexed(lut, lut, lut, null, bitsPerSample, dataType);
|
||||||
}
|
}
|
||||||
|
@ -610,6 +610,20 @@ public class TIFFImageReaderTest extends ImageReaderAbstractTest<TIFFImageReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMinIsWhiteWithProfile() throws IOException {
|
||||||
|
ImageReader reader = createReader();
|
||||||
|
try (ImageInputStream stream = ImageIO.createImageInputStream(getClassLoaderResource("/tiff/ccitt/min-is-white-with-profile.tif"))) {
|
||||||
|
reader.setInput(stream);
|
||||||
|
|
||||||
|
BufferedImage image = reader.read(0);
|
||||||
|
assertNotNull(image);
|
||||||
|
|
||||||
|
assertEquals(0xFFFFFFFF, image.getRGB(0, 0));
|
||||||
|
assertEquals(0xFFFFFFFF, image.getRGB(50, 50));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadWithSubsampleParamPixelsJPEG() throws IOException {
|
public void testReadWithSubsampleParamPixelsJPEG() throws IOException {
|
||||||
// Tiled "new style" JPEG
|
// Tiled "new style" JPEG
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user