feat: rename opacity

This commit is contained in:
Albert Trott
2024-07-30 09:07:03 +02:00
parent f7f47596a7
commit aeafbe2113
+5 -4
View File
@@ -12,10 +12,11 @@ class ImageBlender:
"required": {
"base_image": ("IMAGE",),
"blend_image": ("IMAGE",),
"opacity": ("FLOAT", {
"strength": ("FLOAT", {
"default": 1,
"min": 0.0,
"max": 1.0
"max": 1.0,
"step": 0.01
}),
"blend_mode": (
[mode.value for mode in BlendModes],
@@ -31,7 +32,7 @@ class ImageBlender:
FUNCTION = "blend"
CATEGORY = "ImageBlender"
def blend(self, base_image: torch.Tensor, blend_image: torch.Tensor, opacity: float, blend_mode: str, mask: torch.Tensor = None) -> tuple:
def blend(self, base_image: torch.Tensor, blend_image: torch.Tensor, strength: float, blend_mode: str, mask: torch.Tensor = None) -> tuple:
blend_function = self.blend_functions.get(BlendModes(blend_mode), lambda x, y: x)
result = blend_function(base_image, blend_image)
@@ -46,7 +47,7 @@ class ImageBlender:
result = result * mask + base_image * (1 - mask)
# Apply opacity
result = base_image * opacity + result * (1 - opacity)
result = result * strength + base_image * (1 - strength)
# Normalize the result
result = torch.clamp(result, 0, 1)
return (result,)