Skip to content

Commit

Permalink
Merge pull request #16751 from Neokmi/master
Browse files Browse the repository at this point in the history
Fix  Codeformer and gfpgan extension , Inconsistent overlay layer types when visibility value is less than 1
  • Loading branch information
w-e-w authored Dec 25, 2024
2 parents f25c3fc + f113474 commit 1a773bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/postprocessing_codeformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def process(self, pp: scripts_postprocessing.PostprocessedImage, enable, codefor
res = Image.fromarray(restored_img)

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)

pp.image = res
Expand Down
4 changes: 4 additions & 0 deletions scripts/postprocessing_gfpgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def process(self, pp: scripts_postprocessing.PostprocessedImage, enable, gfpgan_
res = Image.fromarray(restored_img)

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)

pp.image = res
Expand Down

0 comments on commit 1a773bf

Please sign in to comment.