BufferedImage bufferedImage = ImageIO.read(new File("/...icon.jpg"));
// this writes the bufferedImage into a byte array called resultingBytes
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
ImageIO.write(bufferedImage, "jpg", byteArrayOut);
byte[] resultingBytes = byteArrayOut.toByteArray();
我使用上面的代码将 JEPG 图像作为字节数组获取。我想知道这个字节数组中到底是什么。该数组是否包含任何文件头信息或仅包含像素值?例如,如果我想反转这张图片的颜色,有什么好的方法呢?非常感谢!