• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Converting an byte[] to an image

 
Zac Styris
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyyone

I want to convet an byte[] which i've received from a mobile phone in to a image (jpg/png) after i receive it on the J2SE server end. Please some one help me with the method which i can just convert a byte[] in to a image n store it on the hard drive of the computer.

Thanks
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.imageio.ImageIO can do what you need.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the format of the data in the byte array? if it is already in JFIF (that's jpeg) or PNG format, just use java.io.* to write the data to a file. In other words, is there really a *need* to convert the data to an image?
[ January 27, 2006: Message edited by: Jeff Albertson ]
 
Rashid Mayes
Ranch Hand
Posts: 160
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use JAI.



After you have the RenderedOp you can manipulate it how you want. For exampple,

 
Zac Styris
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys, Java.io just works fine n suits for wut i wanna do, thanks for helping again.

Rock on
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic