//by @plugnburn function str2png(datastr) { //string as input, ready compressed PNG data URI as output var data = unescape(encodeURIComponent(datastr)); var dlen = data.length; var dim = Math.ceil(Math.sqrt(dlen/3)) var cnv = document.createElement("canvas"); cnv.width=cnv.height=dim; var ctx=cnv.getContext("2d"); var idata=ctx.createImageData(dim,dim); var p = -1; for(var i=0;i