JSFiddle - React, Tailwind, and code Playground

HTML

http://fiddle.jshell.net/img/logo.png<br/>
<img src="http://fiddle.jshell.net/img/logo.png" onclick="rotate(this)"/><br/>
http://www.google.com/intl/en_com/images/srpr/logo3w.png<br/>
<img src="http://www.google.com/intl/en_com/images/srpr/logo3w.png" onclick="rotate(this)"/>

JavaScript

document.write('Domain: '+document.domain +'<br/>');
function rotate(img){
    var width = img.height,
        height = img.width,
        canvas = document.createElement('canvas'),
        context = canvas.getContext('2d');
    
    canvas.width = width;
    canvas.height = height;
    
    context.rotate(- Math.PI / 2);
    context.drawImage(img, -height, 0);
    
    // This works only if the image is on the same site of the running script, or a SECURITY_ERR will be raised
    img.src = canvas.toDataURL('image/png');
};