This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Murach's Java Programming and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

BufferedImage from byte[]  RSS feed

 
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: 42972
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
Boost this thread!