function showRotatedImage(canvas, context, image, angleInDegrees) {
    var angleInRadians = angleInDegrees * (Math.PI/180)
    var x = canvas.width / 2;
    var y = canvas.height / 2;
    var width = image.width;
    var height = image.height;

    context.clearRect(0, 0, canvas.width, canvas.height);
    context.translate(x, y);
    context.rotate(angleInRadians);
 
    context.drawImage(image, -width / 2, -height / 2, width, height);
    context.rotate(-angleInRadians);
    context.translate(-x, -y);
    
 }
/**
  * Rotate the image by the specified amount in degrees
  * 
  * @param {object} canvas 
  * @param {object} context 
  * @param {object} image 
  * @param {float} angleInDegrees 
  * 
  */
Rotate the image by the specified amount in degrees


Rotate the image by the specified amount in degrees
function showRotatedImage(canvas, context, image, angleInDegrees) {
    var angleInRadians = angleInDegrees * (Math.PI/180)
    var x = canvas.width / 2;
    var y = canvas.height / 2;
    var width = image.width;
    var height = image.height;
    context.clearRect(0, 0, canvas.width, canvas.height);
    context.translate(x, y);
    context.rotate(angleInRadians);
    context.drawImage(image, -width / 2, -height / 2, width, height);
    context.rotate(-angleInRadians);
    context.translate(-x, -y);
 }
function showRotatedImage ( canvas , context , image , angleInDegrees ) { var angleInRadians = angleInDegrees * ( Math . PI / 180 ) var x = canvas . width / 2 ; var y = canvas . height / 2 ; var width = image . width ; var height = image . height ; context . clearRect ( 0 , 0 , canvas . width , canvas . height ) ; context . translate ( x , y ) ; context . rotate ( angleInRadians ) ; context . drawImage ( image , - width / 2 , - height / 2 , width , height ) ; context . rotate ( - angleInRadians ) ; context . translate ( - x , - y ) ; }
Rotate the image by the specified amount in degrees
Rotate the image by the specified amount in degrees