• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image into serializable object?

 
sai pabb
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm new to Java images/IO. I've an api which gives me Image object, All I need to do is save the Image onto the server. So, Applet gets an image from the sanner api, the api returns Image object. I need to serialize this and send this to the servlets. Now the servlet has to save this onto the filesystem. Could you help me through this process?
 
C Popp
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try wrapping the Image object in an ImageIcon object which does implement Serializable.

http://download.oracle.com/javase/1.5.0/docs/api/javax/swing/ImageIcon.html
 
Rob Spoor
Sheriff
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or use ImageIO to turn the image into a byte[]. Use ByteArrayOutputStream and ByteArrayInputStream as intermediaries.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic