Here you can find the source of imageIconToBufferedImage(ImageIcon icon)
public static BufferedImage imageIconToBufferedImage(ImageIcon icon)
//package com.java2s; //License from project: Apache License import java.awt.Graphics; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; public class Main { public static BufferedImage imageIconToBufferedImage(ImageIcon icon) { BufferedImage bufferedImage = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); Graphics graphics = bufferedImage.createGraphics(); icon.paintIcon(null, graphics, 0, 0); graphics.dispose();//from w ww.j a va 2 s. co m return bufferedImage; } }