This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Write image to a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Write image to a file" Watch "Write image to a file" New topic
Author

Write image to a file

prav ford
Greenhorn

Joined: Apr 28, 2004
Posts: 16
Hi,
I have a panel. I select a gif/jpg/* Image file and display the Image on the Panel. Then I have a save button, thru which i have to save the image into a file.

To put it in clear words...I need to read an image from a file and write the image to another file.

Any Ideas.
Thanks,
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
If you are using j2se 1.4+ you can use the ImageIO class to read and write images. It will read .gif, .jpg and .png and write .jpg and .png images. To save an image:

A special download is available from Sun for other image extensions.
Martin Thorpe
Ranch Hand

Joined: May 25, 2004
Posts: 45
yeah that is how it worked for me... sample code below:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Write image to a file
 
Similar Threads
How to know the absolute directory path of WebContent folder?
Casting problem. Image to BufferedImage
Bmp, gif, jpeg
Save Problem bcz of Diff Panels
Saving a Jpanel as a JPEG