Hello,
I am using the below given code, but it is not working properly. Can anybody tell me how do i generate thumbnail of the image? because i am creating a photo album and i want only thumbnail images to be downloaded at first, not the entire 400-500 kb images.
File objFile = new File(strImageFullPath);
File targetFile = new File(strImageFullPathWithoutExt + "_small" + strFileExtension);
Image image = ImageIO.read(objFile);
final int WIDTH = 150;
final int HEIGHT = 150;
Image thumbnailImage = image.getScaledInstance(WIDTH, HEIGHT, Image.SCALE_DEFAULT);
BufferedImage objThumbnailBufferedImage = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
Graphics gfx = objThumbnailBufferedImage.getGraphics();
gfx.drawImage(image, 0, 0, null);
gfx.dispose();
ImageIO.write(objThumbnailBufferedImage, strFileExtension.substring(1), targetFile);
Just assume that few variables like strImageFullPath,strImageFullPathWithoutExt etc they exist.
Thanks in advance :)