Is there any way to resize image uploaded to server? I have uploaded a image using servlet and JSP. Now I want to resize that image according to fixed ratio.
Is there any API available?
Is there any way to resize image uploaded to server? I have uploaded a image using servlet and JSP. Now I want to resize that image according to fixed ratio.
Is there any API available?
Image newimg = img.getScaledInstance(scale, scale,
java.awt.Image.SCALE_SMOOTH);
Quoting from http://www.mkyong.com/java/how-to-resize-an-image-in-java/
Graphics2D is providing the image re-size feature as follows :
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();