code: private static BufferedImage scale(BufferedImage imageToScale, int dWidth, int dHeight, double fWidth, double fHeight) {
          BufferedImage dbi = null;
          // Needed to create a new BufferedImage object
          int imageType = imageToScale.getType();
          if (imageToScale != null) {
              dbi = new BufferedImage(dWidth, dHeight, imageType);
              Graphics2D g = dbi.createGraphics();
              AffineTransform at = AffineTransform.getScaleInstance(fWidth, fHeight);
              g.drawRenderedImage(imageToScale, at);
          }
          return dbi;
      }
docs: Image scale method
  @param imageToScale The image to be scaled
  @param dWidth Desired width, the new image object is created to this size
  @param dHeight Desired height, the new image object is created to this size
  @param fWidth What to multiply the width by. value < 1 scales down, and value > one scales up
  @param fHeight What to multiply the height by. value < 1 scales down, and value > one scales up
  @return A scaled image