question: public static BufferedImage toBufferedImage ( Image img , int type ) { if ( img instanceof BufferedImage ) { return ( BufferedImage ) img ; } BufferedImage bimage = new BufferedImage ( img . getWidth ( null ) , img . getHeight ( null ) , type ) ; Graphics2D bGr = bimage . createGraphics ( ) ; bGr . drawImage ( img , 0 , 0 , null ) ; bGr . dispose ( ) ; return bimage ; }
target:  Converts a given Image into a BufferedImage