2D Graphics Java Tutorial

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
public class Main {
  public static void main(String[] argv) throws Exception {
    Image image = new ImageIcon("image.gif").getImage();
    BufferedImage bimage = new BufferedImage(image.getWidth(null), image
        .getHeight(null), BufferedImage.TYPE_INT_RGB);
    Graphics2D g = bimage.createGraphics();
    g.drawImage(image, 0, 0, null);
    g.dispose();
  }
}