I have a html5 canvas. I want to draw/rotate the image in the canvas and image size does not change.I set width/height of canvas base on size of image.I have a problem to r
If you rotate your image, you can recalculate the boundingbox needed to contain it.


This code will takes width/height/rotation angle and returns the new bounding box size:
function newSize(w,h,a){
var rads=a*Math.PI/180;
var c = Math.cos(rads);
var s = Math.sin(rads);
if (s < 0) { s = -s; }
if (c < 0) { c = -c; }
size.width = h * s + w * c;
size.height = h * c + w * s ;
}
Here is example code and a Fiddle: http://jsfiddle.net/m1erickson/h65yr/