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.
This commit is contained in:
Don 2022-08-27 11:55:00 -04:00 committed by GitHub
parent b860dbd9a6
commit bac08306fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -367,6 +367,7 @@ async function makeImage() {
outputMsg.innerHTML = 'Fetching..' 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 seed = (randomSeedField.checked ? Math.floor(Math.random() * 10000) : parseInt(seedField.value))
let numOutputsTotal = parseInt(numOutputsTotalField.value) let numOutputsTotal = parseInt(numOutputsTotalField.value)
let numOutputsParallel = parseInt(numOutputsParallelField.value) let numOutputsParallel = parseInt(numOutputsParallelField.value)
@ -382,11 +383,11 @@ async function makeImage() {
height: heightField.value, height: heightField.value,
} }
if (initImagePreview.src.indexOf('data:image/png;base64') !== -1) { if (imageRegex.test(initImagePreview.src)) {
reqBody['init_image'] = initImagePreview.src reqBody['init_image'] = initImagePreview.src
reqBody['prompt_strength'] = parseInt(promptStrengthField.value) / 10 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 reqBody['mask'] = maskImagePreview.src
} }
} }