#658: TGAImageReaderSpi now recognizes "true color" images with valid palette depth != 0

This commit is contained in:
Harald Kuhr
2022-01-19 08:32:44 +01:00
parent ac8a36db1c
commit b8f2a80ca6
3 changed files with 6 additions and 3 deletions
@@ -94,8 +94,9 @@ public final class TGAImageReaderSpi extends ImageReaderSpiBase {
int colorMapDepth = stream.readUnsignedByte();
if (colorMapSize == 0) {
// No color map, all 3 fields should be 0
if (colorMapStart != 0 || colorMapDepth != 0) {
// No color map, all 3 fields should be 0 (but some files contain bogus colorMapDepth)
if (colorMapStart != 0 || colorMapDepth != 0
&& colorMapDepth != 15 && colorMapDepth != 16 && colorMapDepth != 24 && colorMapDepth != 32) {
return false;
}
}