mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-12-26 08:58:54 +01:00
Merge pull request #724 from patriceac/img2img-settings-restoration
Img2img settings restoration
This commit is contained in:
commit
b11aa4833d
@ -144,6 +144,13 @@ const TASK_MAPPING = {
|
|||||||
readUI: () => (maskSetting.checked ? imageInpainter.getImg() : undefined),
|
readUI: () => (maskSetting.checked ? imageInpainter.getImg() : undefined),
|
||||||
parse: (val) => val
|
parse: (val) => val
|
||||||
},
|
},
|
||||||
|
preserve_init_image_color_profile: { name: 'Preserve Color Profile',
|
||||||
|
setUI: (preserve_init_image_color_profile) => {
|
||||||
|
applyColorCorrectionField.checked = parseBoolean(preserve_init_image_color_profile)
|
||||||
|
},
|
||||||
|
readUI: () => applyColorCorrectionField.checked,
|
||||||
|
parse: (val) => parseBoolean(val)
|
||||||
|
},
|
||||||
|
|
||||||
use_face_correction: { name: 'Use Face Correction',
|
use_face_correction: { name: 'Use Face Correction',
|
||||||
setUI: (use_face_correction) => {
|
setUI: (use_face_correction) => {
|
||||||
@ -282,6 +289,7 @@ const TASK_MAPPING = {
|
|||||||
parse: (val) => val
|
parse: (val) => val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreTaskToUI(task, fieldsToSkip) {
|
function restoreTaskToUI(task, fieldsToSkip) {
|
||||||
fieldsToSkip = fieldsToSkip || []
|
fieldsToSkip = fieldsToSkip || []
|
||||||
|
|
||||||
@ -320,20 +328,26 @@ function restoreTaskToUI(task, fieldsToSkip) {
|
|||||||
if (!('use_upscale' in task.reqBody)) {
|
if (!('use_upscale' in task.reqBody)) {
|
||||||
useUpscalingField.checked = false
|
useUpscalingField.checked = false
|
||||||
}
|
}
|
||||||
if (!('mask' in task.reqBody)) {
|
if (!('mask' in task.reqBody) && maskSetting.checked) {
|
||||||
maskSetting.checked = false
|
maskSetting.checked = false
|
||||||
|
maskSetting.dispatchEvent(new Event("click"))
|
||||||
}
|
}
|
||||||
upscaleModelField.disabled = !useUpscalingField.checked
|
upscaleModelField.disabled = !useUpscalingField.checked
|
||||||
upscaleAmountField.disabled = !useUpscalingField.checked
|
upscaleAmountField.disabled = !useUpscalingField.checked
|
||||||
|
|
||||||
// Show the source picture if present
|
// hide/show source picture as needed
|
||||||
initImagePreview.src = (task.reqBody.init_image == undefined ? '' : task.reqBody.init_image)
|
if (IMAGE_REGEX.test(initImagePreview.src) && task.reqBody.init_image == undefined) {
|
||||||
if (IMAGE_REGEX.test(initImagePreview.src)) {
|
// hide source image
|
||||||
if (Boolean(task.reqBody.mask)) {
|
initImageClearBtn.dispatchEvent(new Event("click"))
|
||||||
setTimeout(() => { // add a delay to insure this happens AFTER the main image loads (which reloads the inpainter)
|
|
||||||
imageInpainter.setImg(task.reqBody.mask)
|
|
||||||
}, 250)
|
|
||||||
}
|
}
|
||||||
|
else if (task.reqBody.init_image !== undefined) {
|
||||||
|
// listen for inpainter loading event, which happens AFTER the main image loads (which reloads the inpainter)
|
||||||
|
initImagePreview.addEventListener('load', function() {
|
||||||
|
if (Boolean(task.reqBody.mask)) {
|
||||||
|
imageInpainter.setImg(task.reqBody.mask)
|
||||||
|
}
|
||||||
|
}, { once: true })
|
||||||
|
initImagePreview.src = task.reqBody.init_image
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function readUI() {
|
function readUI() {
|
||||||
|
Loading…
Reference in New Issue
Block a user