Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert BufferedImage to ImageIcon

How can I convert a BufferedImage to an ImageIcon?

I can not find any documentation on this.

like image 855
Get Off My Lawn Avatar asked Sep 10 '25 02:09

Get Off My Lawn


2 Answers

Use constructor: ImageIcon(Image image), BufferedImage extends Image.

like image 155
Nemanja Avatar answered Sep 12 '25 18:09

Nemanja


BufferedImage extends Image, so it's simply:

new ImageIcon(myBufferedImage);
like image 36
schippi Avatar answered Sep 12 '25 17:09

schippi