Merge pull request #16751 from Neokmi/master

Fix  Codeformer and gfpgan extension , Inconsistent overlay layer types when visibility value is less than 1
This commit is contained in:
w-e-w 2024-12-26 06:33:04 +09:00 committed by GitHub
commit 1a773bf2c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,10 @@ 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:
if pp.image.size != res.size:
res = res.resize(pp.image.size)
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

View File

@ -26,6 +26,10 @@ class ScriptPostprocessingGfpGan(scripts_postprocessing.ScriptPostprocessing):
res = Image.fromarray(restored_img) res = Image.fromarray(restored_img)
if gfpgan_visibility < 1.0: if gfpgan_visibility < 1.0:
if pp.image.size != res.size:
res = res.resize(pp.image.size)
if pp.image.mode != res.mode:
res = res.convert(pp.image.mode)
res = Image.blend(pp.image, res, gfpgan_visibility) res = Image.blend(pp.image, res, gfpgan_visibility)
pp.image = res pp.image = res