I am writing a quick little java class that resizes an image into various smaller sizes (thumbnail large/small/etc). I have seen examples that have RenderingHints in it. The output file is significantly larger than without.
My question is: Is it necessary to use RenderingHints if the images that are being resized have no text?
int IMG_WIDTH = 100;
int IMG_HEIGHT = 100;
BufferedImage resizedImage = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, type);
Graphics2D g = resizedImage.createGraphics();
g.drawImage(originalImage, 0, 0, IMG_WIDTH, IMG_HEIGHT, null);
g.dispose();
g.setComposite(AlphaComposite.Src);
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
I started with a 45kb image, and the output difference is a 3kb file (without RenderingHints) versus a 24kb file (with RenderingHints)