mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 04:25:29 -04:00
#285: Fix for non-spec BMPs without palette.
This commit is contained in:
parent
b116b4b5a7
commit
17eeda210e
@ -160,6 +160,7 @@ public final class BMPImageReader extends ImageReaderBase {
|
||||
}
|
||||
}
|
||||
|
||||
if (colors.length > 0) {
|
||||
// There might be more entries in the color map, but we ignore these for reading
|
||||
int mapSize = Math.min(colors.length, 1 << header.getBitCount());
|
||||
|
||||
@ -169,6 +170,7 @@ public final class BMPImageReader extends ImageReaderBase {
|
||||
colorMap = new IndexColorModel(bits, mapSize, colors, 0, false, -1, DataBuffer.TYPE_BYTE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return colorMap;
|
||||
}
|
||||
|
@ -108,7 +108,8 @@ public class BMPImageReaderTest extends ImageReaderAbstractTest<BMPImageReader>
|
||||
new TestData(getClassLoaderResource("/bmp/blauesglas_24.bmp"), new Dimension(301, 331)),
|
||||
new TestData(getClassLoaderResource("/bmp/blauesglas_32.bmp"), new Dimension(301, 331)),
|
||||
new TestData(getClassLoaderResource("/bmp/blauesglas_32_bitmask888.bmp"), new Dimension(301, 331)),
|
||||
new TestData(getClassLoaderResource("/bmp/blauesglas_32_bitmask888_reversed.bmp"), new Dimension(301, 331))
|
||||
new TestData(getClassLoaderResource("/bmp/blauesglas_32_bitmask888_reversed.bmp"), new Dimension(301, 331)),
|
||||
new TestData(getClassLoaderResource("/bmp/24bitpalette.bmp"), new Dimension(320, 200))
|
||||
);
|
||||
}
|
||||
|
||||
|
BIN
imageio/imageio-bmp/src/test/resources/bmp/24bitpalette.bmp
Normal file
BIN
imageio/imageio-bmp/src/test/resources/bmp/24bitpalette.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 188 KiB |
Loading…
x
Reference in New Issue
Block a user