我在调整图片大小时遇到了奇怪的问题,但无法确定自己哪里出错了。我已经阅读了很多帖子,它们基本上都使用与我相同的代码:
(我使用Java库Scalr)
File image = new File("myimage.png");
File smallImage = new File("myimage_s");
try {
BufferedImage bufimage = ImageIO.read(image);
BufferedImage bISmallImage = Scalr.resize(bufimage, 30); // after this line my dimensions in bISmallImage are correct!
ImageIO.write(bISmallImage, "png", smallImage); // but my smallImage has the same dimension as the original foto
} catch (Exception e) {}
有人可以告诉我我做错了什么吗?
catch (Exception e) {}
将会让你一头雾水。您是否使用调试器逐步执行代码了? - J0e3gan