folkyatina của hoạt động nếu giá trị RGB của bạn là trong B, G, R trật tự, nhưng nếu họ đang ở R, G, trật tự B Tôi đã tìm thấy đoạn mã sau để làm việc:
DataBuffer rgbData = new DataBufferByte(rgbs, rgbs.length);
WritableRaster raster = Raster.createInterleavedRaster(
rgbData, width, height,
width * 3, // scanlineStride
3, // pixelStride
new int[]{0, 1, 2}, // bandOffsets
null);
ColorModel colorModel = new ComponentColorModel(
ColorSpace.getInstance(ColorSpace.CS_sRGB),
new int[]{8, 8, 8}, // bits
false, // hasAlpha
false, // isPreMultiplied
ComponentColorModel.OPAQUE,
DataBuffer.TYPE_BYTE);
return new BufferedImage(colorModel, raster, false, null);
Nguồn
2016-05-28 17:19:45
Cuối cùng tôi không tìm thấy bất cứ điều gì tốt hơn sau đó: \t \t \t for (int y = 0; y
Ma99uS
kích thước của mảng byte là gì? Có phải mảng 1 chiều, mảng 2 chiều hay mảng 3 chiều không? –