first, the main image is loaded from the computer, and then the logo on a transparent background. after which you need to download a picture with a logo
the final image is saved normally if both images are loaded via the Choose file menu. But if the main image is loaded via Choose file, and the logo - with the Add logo button. It is visible in the canvas, but the final image is saved without it, as the logo is not added.
ps If you do not click the Add logo button, everything works in the console on this site. Here is an example of the logo http://chu93.aphp.fr/wp-content/blogs.dir/32/files/2015/10/LOGO-YOUTUBE.png
var canvas = document.getElementById('canvas'), ctx = canvas.getContext('2d'); function draw() { //Π·Π°Π³ΡΡΠ·ΠΊΠ° ΠΊΠ°ΡΡΠΈΠ½ΠΊΠΈ ΠΈΠ· ΡΠ°ΠΉΠ»Π° var ctx = document.getElementById('canvas').getContext('2d'), img = new Image(), f = document.getElementById("uploadimage").files[0], url = window.zURL || window.webkitURL, src = url.createObjectURL(f); img.src = src; img.onload = function() { ctx.drawImage(img, 0, 0, 480, 400); } } document.getElementById("uploadimage").addEventListener("change", draw, false) function Up() { //Π·Π°Π³ΡΡΠ·ΠΊΠ° Π»ΠΎΠ³ΠΎΡΠΈΠΏΠ° var ctx = document.getElementById('canvas').getContext('2d'), img = new Image(), src = "http://chu93.aphp.fr/wp-content/blogs.dir/32/files/2015/10/LOGO-YOUTUBE.png"; img.src = src; img.onload = function() { ctx.drawImage(img, 0, 0, 480, 400); } } function doCanvas() { //ΠΎΡΡΠΈΡΠΎΠ²ΠΊΠ° ΠΏΡΡΡΠΎΠ³ΠΎ ΠΏΠΎΠ»Ρ ctx.fillStyle = '#f90'; ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = '#fff'; ctx.font = '60px sans-serif'; ctx.fillText('Pls choose img', 7, canvas.height / 2 - 10); } function download() { //ΡΠΊΠ°ΡΠΈΠ²Π°Π½Π΅ ΠΊΠ°ΡΡΠΈΠ½ΠΊΠΈ var dt = canvas.toDataURL('image/jpeg'); this.href = dt; }; downloadLnk.addEventListener('click', download, false); <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> </head> <body onload="doCanvas()"> <input type='file' name='img' size='0' id='uploadimage' /> <button type="button" onclick="Up()">Add logo</button> <a id="downloadLnk" download="img.jpg">Download</a> <button onclick="doCanvas()">Clear</button> </br> <canvas id="canvas" width="480" height="400"></canvas> <script src="config.js"></script>