add support to blurry mask and a sharp mask
parent
beb4070661
commit
6cb0e7d9fc
|
|
@ -345,6 +345,31 @@ document.getElementById('tiSeed').value = String(defaultSettings['seed'])
|
|||
|
||||
}
|
||||
////// End Reset Settings Button //////////
|
||||
|
||||
function getMaskBlur(){
|
||||
const isDisabled = document.getElementById('slMaskBlur').hasAttribute('disabled')
|
||||
let mask_blur = 0
|
||||
if(isDisabled){
|
||||
mask_blur = 0
|
||||
}else{
|
||||
mask_blur = document.getElementById('slMaskBlur').value
|
||||
|
||||
}
|
||||
return mask_blur
|
||||
}
|
||||
function getUseSharpMask(){
|
||||
const isChecked = document.getElementById('chUseSharpMask').checked
|
||||
return isChecked
|
||||
}
|
||||
document.getElementById('chUseSharpMask').addEventListener('change',(ev)=>{
|
||||
const isChecked = ev.target.checked
|
||||
if(isChecked){
|
||||
document.getElementById('slMaskBlur').setAttribute('disabled')
|
||||
}else{
|
||||
document.getElementById('slMaskBlur').removeAttribute('disabled')
|
||||
|
||||
}
|
||||
})
|
||||
module.exports = {
|
||||
getPrompt,
|
||||
autoFillInPrompt,
|
||||
|
|
@ -371,5 +396,7 @@ module.exports = {
|
|||
setAutomaticStatus,
|
||||
setProxyServerStatus,
|
||||
defaultSettings,
|
||||
autoFillDefaultSettings
|
||||
autoFillDefaultSettings,
|
||||
getMaskBlur,
|
||||
getUseSharpMask
|
||||
}
|
||||
|
|
@ -361,6 +361,8 @@
|
|||
<sp-label>SD Url:</sp-label><sp-textfield id="tiSdUrl" type="text" placeholder="http://127.0.0.1:7860"
|
||||
value=""></sp-textfield><button class="btnSquare" id="btnSdUrl">Submit</button>
|
||||
</div>
|
||||
<sp-checkbox id="chUseSharpMask">use sharp mask</sp-checkbox>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="sp-tab-page visible" id="sp-stable-diffusion-ui-tab-page">
|
||||
|
|
@ -526,7 +528,8 @@
|
|||
<sp-label slot="label" id="hDenoisingStrength">0.7</sp-label>
|
||||
</sp-slider>
|
||||
|
||||
<sp-slider show-value="true" id="slMaskBlur" min="0" max="64" value="7">
|
||||
|
||||
<sp-slider show-value="true" id="slMaskBlur" min="0" max="64" value="7">
|
||||
<sp-label slot="label">Mask Blur:</sp-label>
|
||||
<!-- <sp-label slot="label" id="lDenoisingStrength">0.7</sp-label> -->
|
||||
</sp-slider>
|
||||
|
|
|
|||
5
index.js
5
index.js
|
|
@ -1379,7 +1379,9 @@ async function getSettings(){
|
|||
const cfg_scale = document.querySelector('#slCfgScale').value
|
||||
// const model_index = document.querySelector("#")
|
||||
const seed = document.querySelector('#tiSeed').value
|
||||
const mask_blur = document.querySelector('#slMaskBlur').value
|
||||
// const mask_blur = document.querySelector('#slMaskBlur').value
|
||||
const use_sharp_mask = html_manip.getUseSharpMask()
|
||||
const mask_blur = html_manip.getMaskBlur()
|
||||
const inpaint_full_res_padding = document.querySelector('#slInpaintPadding').value
|
||||
|
||||
console.dir(numberOfImages)
|
||||
|
|
@ -1472,6 +1474,7 @@ async function getSettings(){
|
|||
cfg_scale: cfg_scale,
|
||||
seed: seed,
|
||||
mask_blur: mask_blur,
|
||||
use_sharp_mask: use_sharp_mask,
|
||||
use_prompt_shortcut: bUsePromptShortcut,
|
||||
prompt_shortcut_ui_dict: prompt_shortcut_ui_dict,
|
||||
uniqueDocumentId: uniqueDocumentId,
|
||||
|
|
|
|||
|
|
@ -59,7 +59,10 @@ async def img2ImgRequest(sd_url,payload):
|
|||
#only if image exist then try to open it
|
||||
if(len(init_img_mask_name) > 0):
|
||||
init_img_mask = Image.open(f"{init_img_dir}/{init_img_mask_name}")
|
||||
init_img_mask = applyDilation(init_img_mask)
|
||||
|
||||
if(payload['use_sharp_mask']):
|
||||
init_img_mask = applyDilation(init_img_mask)
|
||||
|
||||
init_img_mask_str = img_2_b64(init_img_mask)
|
||||
payload['mask'] = init_img_mask_str #there is only one mask, unlike 'init_images' which is of type array
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue