• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BufferedImage from byte[]

 
sanket karkare
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a byte array.
How can I construct a BufferedImage object.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use one of the BufferedImage constructors, then call its getWriteableRaster method, and then use one of its setPixel methods appropriately.

Do you know how the bytes are arranged in the byte[]? Meaning, in which order the Red, Green, Blue and transparency values are arranged (assuming it has those), and the width and height of the image?
 
sanket karkare
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, problem solved
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic