My vision is the solution to this question, an extended answer regarding my comment in the header.
Since you are working with an array of bytes (pixels), you will need to describe a point about which you need to and rotate the image, the point in the center. Next, you need to process the result - after rotation, you will have empty areas that need to be cut off. Follow your actions - you have an image and a canvas. Regarding the canvas, the image must be placed in the center and leave gaps, you must enter to calculate the coefficient, I will leave this iteration to you, your imagination is necessary here. After calculating the coefficient, you simply interpolate the image - reduce it. Well, it remains the most simple of the possible - you put in the center. Calculate the gaps relative to the upper, lower, left and right edges of the canvas.
The task is actually interesting, I described my vision of the solution to this problem.