public static void createResizedImage(final File sourceFile,final File destFile,final int width,final int height,final float quality) throws IOException {
  BufferedImage image=ImageIO.read(sourceFile);
  Dimension dimension=new Dimension(width,height);
  if (image.getHeight() == dimension.height && image.getWidth() == dimension.width) {
    writeUntouchedImage(sourceFile,destFile);
  }
 else {
    resizeImage(image,dimension.width,dimension.height,quality,destFile);
  }
}

public static void createResizedImage ( final File sourceFile , final File destFile , final int width , final int height , final float quality ) throws IOException { BufferedImage image = ImageIO . read ( sourceFile ) ; Dimension dimension = new Dimension ( width , height ) ; if ( image . getHeight ( ) == dimension . height && image . getWidth ( ) == dimension . width ) { writeUntouchedImage ( sourceFile , destFile ) ; } else { resizeImage ( image , dimension . width , dimension . height , quality , destFile ) ; } }
creates image file with fixed width and height .
