diff --git a/app.js b/app.js index 627cc88..e1a0920 100644 --- a/app.js +++ b/app.js @@ -88,4 +88,19 @@ brushInput.addEventListener("input", () => { resizeButton.addEventListener("click", resize); -resize(); \ No newline at end of file +resize(); + +const downloadButton = document.getElementById("download"); + +downloadButton.addEventListener("click", () => { + canvas.toBlob(blob => { + const url = URL.createObjectURL(blob); + const link = document.createElement("a"); + + link.href = url; + link.download = "tile_image.png"; + link.click(); + + URL.revokeObjectURL(url); + }, "image/png"); +}); \ No newline at end of file diff --git a/index.html b/index.html index 9ab817f..c863b8f 100644 --- a/index.html +++ b/index.html @@ -33,6 +33,8 @@ Brush + +