I have a weird problem with resizing images and can't figure out what I'am doing wrong. I've read lots of posts wwhich basically have the same code as I:
(I use the java library 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) {}
Can someone tell me what I am doing wrong?
I do not see anything wrong with your code.
I pulled it into a quick test project in Eclipse targeting Java SE 7 and using imgscalr 4.2 on Windows 7 Pro 64-bit:
With the following
myimage.png
......, it produced the following
myimage_s.png
:Maybe there is an environmental issue that's hamstringing your code, but possibilities that come to mind would come with a clear error.