Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Exporting JLabel Icon to the folder  RSS feed

 
Pranit Sonawane
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all! This code

is used to set icon or image to the jlabel!

now how can I read that icont sat on the jlabel and export as jpg or png to the specific folder like D:\\Pictures\\out.jpg

Any suggestions?
Thanks in Advacne!!!
 
Piet Souris
Rancher
Posts: 1783
55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Pranit,

you can read your gif-file into a BufferedImage instead of onto a JLabel and then save that BufferedImage as jpg.
See the API of the class ImageIO.

And you can do it outside of Java. Any graphics program can do that conversion.

Greetings,
Piet
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!