int w = oldImage.getWidth(null); int h = oldImage.getHeight(null); // Assume we have a handle to a GraphicsConfig object // Create a compatible image BufferedImage bImg = graphicsConfig.createCompatibleImage(w, h); // Get the image Graphics Graphics g = bImg.getGraphics(); // Copy the contents from the old image into the new one g.drawImage(oldImage, 0, 0, null); // dispose the temporary Graphics object we used g.dispose(); // Return the BufferedImage return bImg; }