From bac08306fb96d6ad2918fc9d56991a08f68b7928 Mon Sep 17 00:00:00 2001 From: Don Date: Sat, 27 Aug 2022 11:55:00 -0400 Subject: [PATCH] Allow other image file types underlying library accepts a wide range of filetypes, no need to restrict it to just png. I wanted to use a jpg. --- index.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 196f7284..56278885 100644 --- a/index.html +++ b/index.html @@ -367,6 +367,7 @@ async function makeImage() { outputMsg.innerHTML = 'Fetching..' + const imageRegex = new RegExp('data:image/[A-Za-z]+;base64') let seed = (randomSeedField.checked ? Math.floor(Math.random() * 10000) : parseInt(seedField.value)) let numOutputsTotal = parseInt(numOutputsTotalField.value) let numOutputsParallel = parseInt(numOutputsParallelField.value) @@ -382,11 +383,11 @@ async function makeImage() { height: heightField.value, } - if (initImagePreview.src.indexOf('data:image/png;base64') !== -1) { + if (imageRegex.test(initImagePreview.src)) { reqBody['init_image'] = initImagePreview.src reqBody['prompt_strength'] = parseInt(promptStrengthField.value) / 10 - if (maskImagePreview.src.indexOf('data:image/png;base64') !== -1) { + if (imageRegex.test(maskImagePreview.src)) { reqBody['mask'] = maskImagePreview.src } }