Q: How to get the size of a rotated image knowing only the angle of rotation and the size of the original image using Matlab? I have an image Im of size 50x129 :

It is a part of big cercle in yellow, and a space with blue color. 

I rotated this image Im using imrotate() with an angle of -45°, I get ImR : 
 

I would like to compute the new size of the image ImR ?


One way to do this is to use the function axis of ImR : 
axises = axis;
w1=axises(2)-axises(1);
h1=axises(4)-axises(3);

but I want to be independent from the resulting image ... I mean I would like to, knowing the size of original image and the angle of rotation, get the size of the rotated image. 

Update
I intend to use this code which rotate the point A with an angle t around the Origin point.
function Af = rotate(A,t,Origin)

% Definition of the rotation matrix (rotation around origin)
R=[ ...
    cosd(t) -sind(t)
    sind(t) cosd(t)
    ];

% translation
At = A - Origin;

% rotation of the points A and B
Ar = R*At;


A: Compute the position of the corners of the rotated image using your rotation matrix. And put them all in a matrix as follows: 
rotImgCorners = [
  x_topLeft   ,     y_topleft;
  x_top_right ,   y_top_right;
  %//... bottom left ...
  %//... bottom right ...
]

Then the size of your new image would be:
%// [horizontal size, vertical size] - you can switch it around if you whish
newImgSize = max(rotImgCorners, [], 1) - min(rotImgCorners, [], 1);

