Maybe better than using new Image?

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
Victor Seiji Hariki 2023-01-23 19:24:50 -03:00
parent fc8e6fb557
commit cb36c2b599
2 changed files with 7 additions and 5 deletions

View file

@ -270,7 +270,7 @@
<button
type="button"
title="Add Layer"
onclick="commands.runCommand('addLayer', 'Added Layer')"
onclick="commands.runCommand('addLayer', 'Added Layer', {})"
class="ui icon button">
<div class="icon-file-plus"></div>
</button>
@ -367,7 +367,7 @@
<!-- Content -->
<script src="js/prompt.js?v=7a1c68c" type="text/javascript"></script>
<script src="js/index.js?v=6944460" type="text/javascript"></script>
<script src="js/index.js?v=c4a7bed" type="text/javascript"></script>
<script
src="js/ui/floating/history.js?v=fc92d14"

View file

@ -883,12 +883,14 @@ async function getUpscalers() {
// hacky way to get the correct list of upscalers
var extras_url =
document.getElementById("host").value + "/sdapi/v1/extra-single-image/"; // endpoint for upscaling, needed for the hacky way to get the correct list of upscalers
var empty_image = new Image(1, 1);
var empty_image = document.createElement("canvas");
empty_image.width = 1;
empty_image.height = 1;
var purposefully_incorrect_data = {
"resize-mode": 0, // 0 = just resize, 1 = crop and resize, 2 = resize and fill i assume based on theimg2img tabs options
resize_mode: 0, // 0 = just resize, 1 = crop and resize, 2 = resize and fill i assume based on theimg2img tabs options
upscaling_resize: 2,
upscaler_1: "fake_upscaler",
image: empty_image.src,
image: empty_image.toDataURL(),
};
try {