I use Toolkit.createImage to load images from my harddisk. This returns a java.awt.Image (the runtime class is sun.something.windows.WImage). But I need a java.awt.image.BufferedImage.
My current converter takes the dimensions of the Image and creates a new BufferedImage with those dimensions. Then I retrieve a Graphics2D from the BufferedImage and draw the Image inside. Finally I return the BufferedImage.

This works, but it is very slow. The total startup time for my app ranges from 30 seconds to 2 minutes! And most of it is the time I require to load the images.

Does anyone know a better way to convert Image to BufferedImage?
Current code:
Code:
private static class ImgListener implements java.awt.image.ImageObserver
{
	public boolean imageUpdate(java.awt.Image img, int f, int x, int y, int w, int h) {
		return ((f & java.awt.image.ImageObserver.ALLBITS) == 0);
	}
}

private static BufferedImage createBufferedImage(java.awt.Image img)
{
	// this is damn slow!
	ImgListener listener = new ImgListener();
	int width;
	while((width=img.getWidth(listener)) < 0)
		;
	int height;
	while((height=img.getHeight(listener)) < 0)
		;
	BufferedImage out = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
	java.awt.Graphics2D g = out.createGraphics();
	while(!g.drawImage(img, new java.awt.geom.AffineTransform(), listener))
		;
	return out;
}
Thanks in advance!