+ Suggestions:
+
+ 1. If you have set an initial image, please try reducing its dimension to ${MAX_INIT_IMAGE_DIMENSION}x${MAX_INIT_IMAGE_DIMENSION} or smaller.
+ 2. Try disabling the 'Turbo mode' under 'Advanced Settings'.
+ 3. Try generating a smaller image. `
+ }
} else {
msg = res
}
@@ -643,20 +668,44 @@ async function doMakeImage(reqBody) {
return true
}
+function validateInput() {
+ let width = parseInt(widthField.value)
+ let height = parseInt(heightField.value)
+
+ if (IMAGE_REGEX.test(initImagePreview.src)) {
+ if (initImagePreview.naturalWidth > MAX_INIT_IMAGE_DIMENSION || initImagePreview.naturalHeight > MAX_INIT_IMAGE_DIMENSION) {
+ return {'isValid': false, 'warning': `The dimensions of your initial image are very large, and can cause 'Out of Memory' errors! Please ensure that its dimensions are equal (or smaller) than the desired output image.
+
+ Your initial image size is ${initImagePreview.naturalWidth}x${initImagePreview.naturalHeight} pixels. Please try to keep it smaller than ${MAX_INIT_IMAGE_DIMENSION}x${MAX_INIT_IMAGE_DIMENSION}.`}
+ }
+ }
+
+ return {'isValid': true}
+}
+
async function makeImage() {
if (serverStatus !== 'online') {
logError('The server is still starting up..')
return
}
+ let validation = validateInput()
+ if (validation['isValid']) {
+ outputMsg.innerHTML = 'Fetching..'
+ } else {
+ if (validation['error']) {
+ logError(validation['error'])
+ return
+ } else if (validation['warning']) {
+ logMsg(validation['warning'], 'warn')
+ }
+ }
+
setStatus('request', 'fetching..')
makeImageBtn.innerHTML = 'Processing..'
makeImageBtn.disabled = true
- 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)
@@ -685,11 +734,11 @@ async function makeImage() {
use_full_precision: useFullPrecisionField.checked
}
- if (imageRegex.test(initImagePreview.src)) {
+ if (IMAGE_REGEX.test(initImagePreview.src)) {
reqBody['init_image'] = initImagePreview.src
reqBody['prompt_strength'] = parseInt(promptStrengthField.value) / 10
- // if (imageRegex.test(maskImagePreview.src)) {
+ // if (IMAGE_REGEX.test(maskImagePreview.src)) {
// reqBody['mask'] = maskImagePreview.src
// }
}