Skip to content

Commit

Permalink
Update postprocessing_codeformer.py
Browse files Browse the repository at this point in the history
Fix  Codeformer extension , Inconsistent overlay layer types when visibility value is less than 1
  • Loading branch information
Neokmi authored Dec 25, 2024
1 parent 82a973c commit 7953c57
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/postprocessing_codeformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ def process(self, pp: scripts_postprocessing.PostprocessedImage, enable, codefor
res = Image.fromarray(restored_img)

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)

pp.image = res
Expand Down

0 comments on commit 7953c57

Please sign in to comment.