1 2 3 4 5 6 7 8 9 10 11 12
|
int width = ...;
int height = ...;
byte[] rawArray = ...;
...
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
int[] nBits = {8, 8, 8};
int[] bOffs = {2, 1, 0};
ColorModel colorModel = new ComponentColorModel(cs, nBits, false, false,Transparency.OPAQUE,DataBuffer.TYPE_BYTE);
WritableRaster raster = Raster.createInterleavedRaster(new DataBufferByte(rawArray,rawArray.length),width, height, width * 3, 3,bOffs, null);
BufferedImage imgReconstructed = new BufferedImage(colorModel,raster,false,null); |
Partager