Added test case for RGB JPEG

+ fixed an issue in getImageTypes to avoid incompatible conversion.
This commit is contained in:
Harald Kuhr
2018-01-05 12:49:54 +01:00
parent 3a86bfab98
commit fb3c5f8440
4 changed files with 40 additions and 2 deletions
@@ -274,6 +274,20 @@ public final class JPEGImageReader extends ImageReaderBase {
return typeList.iterator();
}
else if (csType == JPEGColorSpace.RGB) {
// Bug in com.sun...JPEGImageReader: returns gray as acceptable type, but refuses to convert
ArrayList<ImageTypeSpecifier> typeList = new ArrayList<>();
// Filter out the gray type
while (types.hasNext()) {
ImageTypeSpecifier type = types.next();
if (type.getBufferedImageType() != BufferedImage.TYPE_BYTE_GRAY) {
typeList.add(type);
}
}
return typeList.iterator();
}
return types;
}