mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-16 22:58:19 +08:00
fix(FeatherMask): correct negative zero indexing for right/bottom feathering
In the FeatherMask node, when applying right and bottom feathering, the loop variable starts at 0, making `-x` and `-y` equal to `-0`, which in Python indexes the first element (index 0) instead of the last. This causes the first column/row to be incorrectly modified while the last column/row is left untouched. Fix by using `-(x + 1)` and `-(y + 1)` so the loop correctly starts from the last element (index -1) and works inward, matching the behavior of the left/top feathering loops which start from index 0 and work outward.
This commit is contained in:
parent
3ad36d6be6
commit
730eeec5d3
@ -322,7 +322,7 @@ class FeatherMask(IO.ComfyNode):
|
||||
|
||||
for x in range(right):
|
||||
feather_rate = (x + 1) / right
|
||||
output[:, :, -x] *= feather_rate
|
||||
output[:, :, -(x + 1)] *= feather_rate
|
||||
|
||||
for y in range(top):
|
||||
feather_rate = (y + 1) / top
|
||||
@ -330,7 +330,7 @@ class FeatherMask(IO.ComfyNode):
|
||||
|
||||
for y in range(bottom):
|
||||
feather_rate = (y + 1) / bottom
|
||||
output[:, -y, :] *= feather_rate
|
||||
output[:, -(y + 1), :] *= feather_rate
|
||||
|
||||
return IO.NodeOutput(output)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user