可以使用以下代码将 byte[] 像素数组转换为 Bitmap:
byte[] pixels = ...; // 像素数组
int width = ...; // 图像宽度
int height = ...; // 图像高度
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmap.copyPixelsFromBuffer(ByteBuffer.wrap(pixels));
注意,在上述代码中,我们假设像素数组的格式为 ARGB_8888,也就是说,每个像素由 4