question: public static BufferedImage convertToBufferedImage ( Image awtImg , int type ) { BufferedImage bimg ; if ( awtImg instanceof BufferedImage ) { bimg = ( BufferedImage ) awtImg ; } else { bimg = createCompatibleBufferedImage ( awtImg . getWidth ( null ) , awtImg . getHeight ( null ) , type ) ; Graphics2D g = bimg . createGraphics ( ) ; g . drawImage ( awtImg , 0 , 0 , null , null ) ; g . dispose ( ) ; } return bimg ; }
target:  Utility method to convert an AWT Image to a BufferedImage. Size is preserved, BufferedImage is compatible with current display device.