Here's a little push in the right direction.
Given that W and H are the width and height of the parent view, and theta is the rotation angle of the image, then the image width (x) can be calculated as
x = W * cos(theta) + H * sin(theta);
From that result, you can calculate the scale factor for the image, which in turn gives you the image height. The rest is left as an exercise for the reader.