canvas antialiasing with pica

HTML

<body>
    <div>
        <button onclick="rotate()">Rotate and resize me 200 times</button>
    </div>
    <div style="margin: 0 0 0 90px">
        <canvas id='canvas' width="180" height="351"></canvas>
    </div>
</body>

JavaScript

/* pica 1.0.7 nodeca/pica */
!function(r){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.pica=r()}}(function(){return function r(t,e,n){function o(a,u){if(!e[a]){if(!t[a]){var f="function"==typeof require&&require;if(!u&&f)return f(a,!0);if(i)return i(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var h=e[a]={exports:{}};t[a][0].call(h.exports,function(r){var e=t[a][1][r];return o(e?e:r)},h,h.exports,r,t,e,n)}return e[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({"./":[function(r,t,e){"use strict";function n(r){return Object.prototype.toString.call(r)}function o(r){return"[object Function]"===n(r)}function i(t,n){var o,i={src:t.src,dest:null,width:0|t.width,height:0|t.height,toWidth:0|t.toWidth,toHeight:0|t.toHeight,quality:t.quality,alpha:t.alpha,unsharpAmount:t.unsharpAmount,unsharpThreshold:t.unsharpThreshold};return u&&e.WW?(o=r("webworkify")(l),o.onmessage=function(r){var e,i,a=t.dest,u=r.data.output;if(a)if(a.set)a.set(u);else for(e=0,i=u.length;i>e;e++)a[e]=u[e];n(r.data.err,u),o.terminate()},t.transferable?o.postMessage(i,[t.src.buffer]):o.postMessage(i),o):(i.dest=t.dest,void h(i,n))}function a(r,t,e,n){var a=r.width,u=r.height,f=t.width,s=t.height;o(e)&&(n=e,e={}),isNaN(e)||(e={quality:e,alpha:!1});var h=t.getContext("2d"),l=h.getImageData(0,0,f,s),c={src:r.getContext("2d").getImageData(0,0,a,u).data,dest:l.data,width:r.width,height:r.height,toWidth:t.width,toHeight:t.height,quality:e.quality,alpha:e.alpha,unsharpAmount:e.unsharpAmount,unsharpThreshold:e.unsharpThreshold,transferable:!0};return i(c,function(r){return r?void n(r):(h.putImageData(l,0,0),void n())})}var u="undefined"!=typeof window&&"Worker"in window;if(u)try{var...