public static void writeIconToPNG(Icon icon, String filename) throws IOException {
		BufferedImage buffi = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(),
			BufferedImage.TYPE_INT_ARGB);
		Graphics graphics = buffi.getGraphics();
		icon.paintIcon(null, graphics, 0, 0);
		ImageIO.write(buffi, "png", new File(filename)); // throws exception
		graphics.dispose();
	}
Writes the given icon out to the file denoted by <code>filename</code> <b> in the PNG format</b>.

@param icon the icon to write
@param filename the filename denoting the write destination
@throws IOException see {@link ImageIO#write(RenderedImage, String, File)}
Ghidra/Framework/Gui/src/main/java/generic/util/image/ImageUtils.java