How can I load an image into a BufferedImage without creating a Component for the MediaTracker?
Created May 4, 2012
Bruno Randolf You can achieve this by using an ImageIcon:
private BufferedImage loadBufferedImageIcon( String filename ) { // Get Image ImageIcon icon = new ImageIcon(filename); Image image = icon.getImage(); // Create empty BufferedImage, sized to Image BufferedImage buffImage = new BufferedImage( image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB); // Draw Image into BufferedImage Graphics g = buffImage.getGraphics(); g.drawImage(image, 0, 0, null); return buffImage; }