Prevent invalid size settings for Use As Input

Images larger than the window size show up as blank sizes when setting the field.  Retain previous (presumably valid) size rather than set an invalid one.
This commit is contained in:
Gary Wolfe 2024-12-23 21:46:25 -05:00
parent 33ca04b916
commit 572b0329cf

View File

@ -626,8 +626,15 @@ function onUseAsInputClick(req, img) {
//Force the image settings size to match the input, as inpaint currently only works correctly
//if input image and generate sizes match.
var tempWidth = widthField.value;
var tempHeight = heightField.value;
widthField.value = img.naturalWidth;
heightField.value = img.naturalHeight;
//If it's unhappy with the new values, restore the original values.
if (widthField.value=="" || heightField.value=="") {
widthField.value = tempWidth;
heightField.value = tempHeight;
}
}
function onUseForControlnetClick(req, img) {