public static BufferedImage convertToBufferedImage ( Image img ) { BufferedImage buff = createCompatibleTranslucentImage ( img . getWidth ( null ) , img . getHeight ( null ) ) ; Graphics2D g2 = buff . createGraphics ( ) ; try { g2 . drawImage ( img , 0 , 0 , null ) ; } finally { g2 . dispose ( ) ; } return buff ; }
Converts the specified image into a compatible buffered image .