How to make transparent color white instead of black in html2canvas?

I modified temporary: _html2canvas.Util.isTransparent from _html2canvas.Util.isTransparent = function(backgroundColor) { return (backgroundColor === “transparent” || backgroundColor === “rgba(0, 0, 0, 0)”); }; to _html2canvas.Util.isTransparent = function(backgroundColor) { return (backgroundColor === “transparent” || backgroundColor === “rgba(0, 0, 0, 0)” || backgroundColor === undefined); }; and after that it was enough to call html2canvas with background parameter set: … Read more

How to save img to user’s local computer using HTML2canvas

NOTE: this answer is from 2015 and the library has been updated. Check the answers below for alternate implementations. Try this (Note that it makes use of the download attribute. See the caniuse support table for browsers that support the download attribute) <script> $(‘#save_image_locally’).click(function(){ html2canvas($(‘#imagesave’), { onrendered: function (canvas) { var a = document.createElement(‘a’); // … Read more