resize - Thumbnail creation in Java -


I want to make thumbnails for a group of images, for that I am using the following code.

  Public Zero Run () {try {bufferedImage originalImage = ImageIO.read (new file (url)); Int type = original image.tatype () == 0? BufferedImage.TYPE_INT_ARGB: originalImage.getType (); IMG_HEIGHT = (Original Image. Giant (* 600) / Original Image. Geteworth (); Buffetedesize resizemage.gpg = resize image (original image, type); ImageIO.write (resizeImageJpg, "jpg", new file (thumbs)); OriginalImage.flush (); ResizeImageJpg.flush (); System.gc (); } Hold (IOException e) {System.out.println (e.getMessage ()); System.out.println ("not created:" + url); }} Private static BufferedImage resizeImage (BufferedImage original image, int type) {BufferedImage resizedImage = new BufferedImage (IMG_WIDTH, IMG_HEIGHT, type); Graphics 2DG = resized image. Categorization (); G.drawImage (original image, 0, 0, IMG_WIDTH, IMG_HEIGHT, empty); G.dispose (); System.gc (); Refunded image; }   

This code is working fine and is making thumbnails. But the problem is that, in the case of large numbers of images, I am getting "Java Hip Space Error". Is this the problem with this code? How can I solve this issue. Thanks in advance. If there is any other code to change your shape, please give me two.

Try this image scaling library, it works fine for me.



Comments