5

To resize the Buffered Image I have the following method:

    BufferedImage resizeImage(BufferedImage img, int newW, int newH) {
    Image tmp = img.getScaledInstance(newW, newH, Image.SCALE_SMOOTH);
    BufferedImage dimg = new BufferedImage(newW, newH, BufferedImage.TRANSLUCENT);
    Graphics2D g2d = dimg.createGraphics();
    g2d.drawImage(tmp, 0, 0, null);
    g2d.dispose();

    return dimg;
}

Is there the better way to resize an image without losing of quality?

Dylan
  • 935
  • 1
  • 11
  • 24
  • 1
    There are lots of better ways, but scaling up is by definition going to reduce the quality. Have a look at the [imgscalr](http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/) for example – MadProgrammer Jul 17 '15 at 07:04

0 Answers0