public static RenderedImage scale(RenderedImage image, float scaleFactor)
RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
RenderedOp resizeOp = SubsampleAverageDescriptor.create(image,
Double.valueOf(scaleFactor), Double.valueOf(scaleFactor), hints);
BufferedImage bufferedResizedImage = resizeOp.getAsBufferedImage();
return bufferedResizedImage;
}