This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Image into serializable object? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Image into serializable object?" Watch "Image into serializable object?" New topic

Image into serializable object?

sai pabb

Joined: Sep 01, 2010
Posts: 9

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

Joined: Aug 08, 2007
Posts: 14
You can try wrapping the Image object in an ImageIcon object which does implement Serializable.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19651

Or use ImageIO to turn the image into a byte[]. Use ByteArrayOutputStream and ByteArrayInputStream as intermediaries.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Image into serializable object?
Similar Threads
Applet Servlet Serialized Object
overlay jpeg with text
problem with the image field
Image or ImageIcon?
Saving an image into oracle