Skip to content

Commit

Permalink
Update postprocessing_gfpgan.py
Browse files Browse the repository at this point in the history
Fix  gfpgan extension , Inconsistent overlay layer types when visibility value is less than 1
  • Loading branch information
Neokmi authored Dec 25, 2024
1 parent 7953c57 commit 6577e06
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/postprocessing_gfpgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ def process(self, pp: scripts_postprocessing.PostprocessedImage, enable, gfpgan_
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
Expand Down

0 comments on commit 6577e06

Please sign in to comment.