Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Write image to a file

 
prav ford
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah that is how it worked for me... sample code below:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic