From 556ec5cb7b23911a75f1eb6fab301b23e3a3ccd7 Mon Sep 17 00:00:00 2001 From: AlexL Date: Thu, 4 Jan 2024 14:36:59 +0100 Subject: [PATCH] Added upscale options --- index.html | 7 +++++-- js/index.js | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 5abdeda..8e2e125 100644 --- a/index.html +++ b/index.html @@ -294,8 +294,11 @@
- +
diff --git a/js/index.js b/js/index.js index d3e4213..6a22c34 100644 --- a/js/index.js +++ b/js/index.js @@ -1430,7 +1430,7 @@ async function getSamplers() { } } -async function upscaleAndDownload() { +async function upscaleAndDownload(download = false, add_resource = false) { // Future improvements: some upscalers take a while to upscale, so we should show a loading bar or something, also a slider for the upscale amount // get cropped canvas, send it to upscaler, download result @@ -1481,7 +1481,17 @@ async function upscaleAndDownload() { upscale_factor + ".png"; link.href = "data:image/png;base64," + data["image"]; - link.click(); + + if (add_resource == true) { + console.log("Add upscaled to resource") + const img = new Image(); + img.src = link.href; + tools.stamp.state.addResource("Upscaled image", img); + } + if (download == true){ + console.log("Download upscaled") + link.click(); + } }); } }