@ Nullable public static BufferedImage resize ( @ Nullable final BufferedImage image ) { if ( null == image ) return image ; final int width = Math . min ( image . getWidth ( ) , 800 ) ; if ( width == image . getWidth ( ) ) return image ; final int height = image . getHeight ( ) * width / image . getWidth ( ) ; @ javax . annotation . Nonnull final BufferedImage rerender = new BufferedImage ( width , height , BufferedImage . TYPE_INT_ARGB ) ; final Graphics gfx = rerender . getGraphics ( ) ; @ javax . annotation . Nonnull final RenderingHints hints = new RenderingHints ( RenderingHints . KEY_INTERPOLATION , RenderingHints . VALUE_INTERPOLATION_BICUBIC ) ; ( ( Graphics2D ) gfx ) . setRenderingHints ( hints ) ; gfx . drawImage ( image , 0 , 0 , rerender . getWidth ( ) , rerender . getHeight ( ) , null ) ; return rerender ; }
Resize buffered image .