Hello,

I am trying to rotate a buffered image.

the problem is that my image is a rectangular image, like 60x40 px.
and the rotation work to square images.

here is my code


private BufferedImage rotate(BufferedImage bufferedImage, double radians) {
AffineTransform at = new AffineTransform();
at.rotate(radians, bufferedImage.getWidth() / 2, bufferedImage.getHeight() / 2);
AffineTransformOp ato = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
return ato.filter(bufferedImage, null);
}




...
rotatedImage = rotate(bufferedImage, 2);
this.setSize(rotatedImage.getWidth(), rotatedImage.getHeight());
this.setIcon(new ImageIcon(rotatedImage));
...



I dont know how to fix this.


Thanks for help.