mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-02-06 21:52:54 +08:00
Update postprocessing_codeformer.py
Fix Codeformer extension , Inconsistent overlay layer types when visibility value is less than 1
This commit is contained in:
parent
82a973c043
commit
7953c570d9
@ -29,6 +29,14 @@ class ScriptPostprocessingCodeFormer(scripts_postprocessing.ScriptPostprocessing
|
|||||||
res = Image.fromarray(restored_img)
|
res = Image.fromarray(restored_img)
|
||||||
|
|
||||||
if codeformer_visibility < 1.0:
|
if codeformer_visibility < 1.0:
|
||||||
|
# Ensure consistent size
|
||||||
|
if pp.image.size != res.size:
|
||||||
|
res = res.resize(pp.image.size)
|
||||||
|
|
||||||
|
# Ensure consistent mode
|
||||||
|
if pp.image.mode != res.mode:
|
||||||
|
res = res.convert(pp.image.mode)
|
||||||
|
|
||||||
res = Image.blend(pp.image, res, codeformer_visibility)
|
res = Image.blend(pp.image, res, codeformer_visibility)
|
||||||
|
|
||||||
pp.image = res
|
pp.image = res
|
||||||
|
Loading…
Reference in New Issue
Block a user