How do I create a BufferedImage from array containing pixels?

后端 未结 3 617
旧时难觅i
旧时难觅i 2021-01-14 18:38

I get the pixels from BufferedImage using the method getRGB(). The pixels are stored in array called data[]. After some manipulation o

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 19:36

    BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    

    Then set the pixels again.

    bufferedImage.setRGB(x, y, your_value);
    

    PS: as stated in the comments, please use the answer from @TacticalCoder

提交回复
热议问题