public static BufferedImage convertImageToGrayscale ( BufferedImage image ) { BufferedImage tmp = new BufferedImage ( image . getWidth ( ) , image . getHeight ( ) , BufferedImage . TYPE_BYTE_GRAY ) ; Graphics2D g2 = tmp . createGraphics ( ) ; g2 . drawImage ( image , 0 , 0 , null ) ; g2 . dispose ( ) ; return tmp ; }
A simple method to convert an image to gray scale .