You cannot rotate an x by y rectangular image without scaling and put it back into the same x by y space except in the limited case of a 180 degree rotation about the image centre. Assuming (because you have not shown us the code that you use to do this rotation) you are rotating about the centre of the x by y image then the rotated image will always fit in a square image sqrt(x*x + y*y) pixels on a side. Alternatively you can compute the minimal size of image you need to place the result in with simple trigonometry.
Bookmarks