Converting a Buffered Image to an Image - Java 2D Graphics

Java examples for 2D Graphics:BufferedImage Convert

Description

Converting a Buffered Image to an Image

Demo Code

import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;

public class Main {
  // This method returns an Image object from a buffered image
  public static Image toImage(BufferedImage bufferedImage) {
    return Toolkit.getDefaultToolkit().createImage(bufferedImage.getSource());
  }//from  w ww  .  j  a v  a  2  s .c om
}

Related Tutorials