public BufferedImage getBufferedImage ( int width , int height ) { // using the new approach of Java 2D API BufferedImage buf = new BufferedImage ( width , height , BufferedImage . TYPE_INT_ARGB ) ; Graphics2D g2d = ( Graphics2D ) buf . getGraphics ( ) ; g2d . setRenderingHint ( RenderingHints . KEY_INTERPOLATION , RenderingHints . VALUE_INTERPOLATION_BILINEAR ) ; g2d . drawImage ( image , 0 , 0 , width , height , null ) ; g2d . dispose ( ) ; return ( buf ) ; }
Resize and return the image passing the new height and width