Java examples for 2D Graphics:BufferedImage Create
create BufferedImage from Image
//package com.java2s; import java.awt.*; import java.awt.image.BufferedImage; public class Main { public static BufferedImage createBufferedImage(Image imageIn, int targetColor) { BufferedImage bufferedImageOut = new BufferedImage( imageIn.getWidth(null), imageIn.getHeight(null), targetColor);//from www. jav a 2 s .com Graphics g = bufferedImageOut.getGraphics(); g.drawImage(imageIn, 0, 0, null); g.dispose(); return bufferedImageOut; } }