1
我需要从文件中读取BufferedImage
,该文件不使用DataBufferInt
(通常情况下),而是使用DataBufferFloat
。Java ImageIO:如何从文件读取BufferedImage,以便它使用DataBufferFloat?
请注意:我不只是需要一些独立的DataBufferFloat
,但真的有潜在DataBufferFloat
BufferedImage
。
围绕这些东西的API非常复杂,我只是无法找到如何做到这一点。
请帮忙。
编辑
发现了什么是不工作:
DataBufferDouble dbd = new DataBufferDouble(destWidth * destHeight * 4);
// Exception here:
// java.lang.IllegalArgumentException: Unsupported data type 5
WritableRaster wr = WritableRaster.createPackedRaster(
dbd, destWidth, destHeight, 32, new Point(0, 0));
BufferedImage bi = new BufferedImage(ColorModel.getRGBdefault(),
wr, false, (Hashtable<?, ?>) null);