Reputation: 147
I was wondering if there was a way of having a ImageIcon[] converted into a series of Buffered Image, I was thinking along the lines of something like this:
public BufferedImage iconArrayToBufferedImage(ImageIcon[] icon){
for (int i = 0; i < icon.length; i++) {
BufferedImage screenShot = new BufferedImage(icon[i]);
}
return screenShot;
}
Upvotes: 1
Views: 2202
Reputation: 168815
E.G. as seen in this answer.
BufferedImage bi = new BufferedImage(
icon.getIconWidth(),
icon.getIconHeight(),
BufferedImage.TYPE_INT_RGB);
Graphics g = bi.createGraphics();
// paint the Icon to the BufferedImage.
icon.paintIcon(null, g, 0,0);
g.dispose();
For many icons, do that in a loop.
Upvotes: 2