-
-
Save martin12333/81543dae058fe3da81ca00dcaedf20a2 to your computer and use it in GitHub Desktop.
A jQuery one-liner for converting all html5 canvas elements in the DOM to PNGs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('canvas').each(function(i,e){ var img = e.toDataURL("image/png"); $(e).replaceWith( $('<img src="'+img+'"/>').attr({width: $(e).attr("width"), height: $(e).attr("height"), style: $(e).attr("style") }) ) }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment