Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Make LatentBlend more consistent with other nodes.

comfyanonymousfa962e86c1cd
diff --git a/nodes.py b/nodes.py
index 86aed032e..92baffe30 100644
--- a/nodes.py
+++ b/nodes.py
@@ -1059,15 +1059,14 @@ class LatentBlend:
@classmethod
def INPUT_TYPES(s):
return {"required": {
- "samples_a": ("LATENT",),
- "samples_b": ("LATENT",),
+ "samples1": ("LATENT",),
+ "samples2": ("LATENT",),
"blend_factor": ("FLOAT", {
"default": 0.5,
"min": 0,
"max": 1,
"step": 0.01
}),
- "blend_mode": (["normal"],),
}}
RETURN_TYPES = ("LATENT",)
@@ -1075,19 +1074,19 @@ class LatentBlend:
CATEGORY = "_for_testing"
- def blend(self, samples_a, samples_b, blend_factor:float, blend_mode: str):
+ def blend(self, samples1, samples2, blend_factor:float, blend_mode: str="normal"):
- samples_out = samples_a.copy()
- samples_a = samples_a["samples"]
- samples_b = samples_b["samples"]
+ samples_out = samples1.copy()
+ samples1 = samples1["samples"]
+ samples2 = samples2["samples"]
- if samples_a.shape != samples_b.shape:
- samples_b.permute(0, 3, 1, 2)
- samples_b = comfy.utils.common_upscale(samples_b, samples_a.shape[3], samples_a.shape[2], 'bicubic', crop='center')
- samples_b.permute(0, 2, 3, 1)
+ if samples1.shape != samples2.shape:
+ samples2.permute(0, 3, 1, 2)
+ samples2 = comfy.utils.common_upscale(samples2, samples1.shape[3], samples1.shape[2], 'bicubic', crop='center')
+ samples2.permute(0, 2, 3, 1)
- samples_blended = self.blend_mode(samples_a, samples_b, blend_mode)
- samples_blended = samples_a * (1 - blend_factor) + samples_blended * blend_factor
+ samples_blended = self.blend_mode(samples1, samples2, blend_mode)
+ samples_blended = samples1 * blend_factor + samples_blended * (1 - blend_factor)
samples_out["samples"] = samples_blended
return (samples_out,)