我现在正在阅读一个图像字节数组,该图像是16位(r:5,g:6,b:5),我想将其读取到BufferedImage中。
我尝试过以下代码:
我的问题是关于bandOffsets的设置,对于16位图像应该如何设置?这样做正确吗? 谢谢, Guy
我尝试过以下代码:
int[] nBits = {5, 6, 5};
int[] bOffs = {0, 0, 0};
ColorModel colorModel = new ComponentColorModel(
cs, nBits, false, false,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
WritableRaster raster = Raster.createInterleavedRaster(
new DataBufferByte(screenBuffer,screenBuffer.length),
foundWidth, foundHight,
foundWidth * 2, 2,bOffs, null);
BufferedImage imgReconstructed = new BufferedImage(
colorModel,raster,false,null);
我的问题是关于bandOffsets的设置,对于16位图像应该如何设置?这样做正确吗? 谢谢, Guy