mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-04-11 15:29:04 +08:00
Update postprocessing_gfpgan.py
Fix gfpgan extension , Inconsistent overlay layer types when visibility value is less than 1
This commit is contained in:
parent
7953c570d9
commit
6577e063d1
@ -26,6 +26,15 @@ class ScriptPostprocessingGfpGan(scripts_postprocessing.ScriptPostprocessing):
|
||||
res = Image.fromarray(restored_img)
|
||||
|
||||
if gfpgan_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, gfpgan_visibility)
|
||||
|
||||
pp.image = res
|
||||
|
Loading…
x
Reference in New Issue
Block a user