How to save the original grayscale image data stored in an array as a picture in Java?

35 views Asked by At

I can obtain the size and original data of the grayscale image through the API, but I have not found a suitable method to store these data as pictures.

I tried using BufferedImage to handle it but don't know how to transfer the contents stored with the array into BufferedImage.

byte[] buffer = API.readGrayScaleImageRawData();
BufferedImage bufferedImage = new BufferedImage(width, length, BufferedImage.TYPE_BYTE_GRAY);

//TODO: how to transfer the content from buffer to bufferedImage 

0

There are 0 answers