title: html rotate entire canvas by 90 degrees
body: <p>I have an image drawn to an html cavas. I would like to be able to rotate the image by 90 degrees but I can't seem to find an example on how to rotate the entire canvas image, only an object on the canvas.</p>
  
  <p>Does anyone have example code to rotate an entire canvas by 90 degrees?</p>
  
  <p>I accepted an anwser below but wanted to provide additional example code : <a href="http://jsfiddle.net/VTyNF/1/" rel="nofollow">http://jsfiddle.net/VTyNF/1/</a></p>
  
  <pre><code>&lt;canvas id="myCanvas" width="578" height="200"&gt;&lt;/canvas&gt;
  
  &lt;script&gt;
    var canvas = document.getElementById('myCanvas');
    var context = canvas.getContext('2d');
  
    context.translate(canvas.width/2,canvas.height/2) 
    context.rotate(90 * (Math.PI / 180));   
    context.beginPath();
    context.rect(188 - canvas.width/2, 50 - canvas.height/2, 200, 100);
    context.fillStyle = 'yellow';
    context.fill();
    context.lineWidth = 7;
    context.strokeStyle = 'black';
    context.stroke();
  &lt;/script&gt;
  </code></pre>