Merge branch 'main' into testing

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
Victor Seiji Hariki 2022-12-08 18:29:34 -03:00
commit 57a2debe5d
2 changed files with 16 additions and 1 deletions

View file

@ -120,6 +120,7 @@
<br /> <br />
<label>Choose upscaler</label> <label>Choose upscaler</label>
<div id="upscaler-ac-select"></div> <div id="upscaler-ac-select"></div>
<div id="upscaleX"></div>
<button onclick="upscaleAndDownload()"> <button onclick="upscaleAndDownload()">
Upscale (might take a sec) Upscale (might take a sec)
</button> </button>

View file

@ -482,6 +482,16 @@ makeSlider(
1, 1,
2 2
); );
makeSlider(
"Upscale X",
document.getElementById("upscaleX"),
"upscale_x",
1.0,
4.0,
0.1,
2.0,
0.1
);
makeSlider("Steps", document.getElementById("steps"), "steps", 1, 70, 5, 30, 1); makeSlider("Steps", document.getElementById("steps"), "steps", 1, 70, 5, 30, 1);
@ -841,7 +851,9 @@ async function upscaleAndDownload() {
// 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 // 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 // get cropped canvas, send it to upscaler, download result
var upscale_factor = 2; // TODO: make this a user input 1.x - 4.0 or something var upscale_factor = localStorage.getItem("upscale_x")
? localStorage.getItem("upscale_x")
: 2;
var upscaler = upscalerAutoComplete.value; var upscaler = upscalerAutoComplete.value;
var croppedCanvas = cropCanvas( var croppedCanvas = cropCanvas(
uil.getVisible({ uil.getVisible({
@ -882,6 +894,8 @@ async function upscaleAndDownload() {
.replace(":", " ") + .replace(":", " ") +
" openOutpaint image upscaler_" + " openOutpaint image upscaler_" +
upscaler + upscaler +
"_x" +
upscale_factor +
".png"; ".png";
link.href = "data:image/png;base64," + data["image"]; link.href = "data:image/png;base64," + data["image"];
link.click(); link.click();