Java Image to BufferedImage makeBufferedImage(final Image image)

Here you can find the source of makeBufferedImage(final Image image)

Description

make Buffered Image

License

MIT License

Return

a BufferedImage from an Image

Declaration

public static BufferedImage makeBufferedImage(final Image image) 

Method Source Code

//package com.java2s;
/** Copyright by Barry G. Becker, 2000-2011. Licensed under MIT License: http://www.opensource.org/licenses/MIT  */

import java.awt.Graphics2D;

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

public class Main {
    /**/*w  ww .  ja  va 2s.  c  om*/
     * @return a BufferedImage from an Image
     */
    public static BufferedImage makeBufferedImage(final Image image) {

        BufferedImage bImg = new BufferedImage(image.getWidth(null), image.getHeight(null),
                BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = bImg.createGraphics();
        g2.drawImage(image, null, null);
        g2.dispose();
        return bImg;
    }
}

Related

  1. ImageToBufferedImage(Image image, int width, int height)
  2. imageToBufferedImage(Image img)
  3. imageToBufferedImage(Image img)
  4. imageToBufferedImage(Image pImage)
  5. imageToBufferedImage(Image src)
  6. makeBufferedImage(Image image)
  7. makeBufferedImage(Image image)
  8. makeRGBABufferedImageFromImage( Image image)
  9. toBufferedImage(Image i)