The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Add a feather option to the latent composite node.
comfyanonymous05ad64d22c0c
diff --git a/nodes.py b/nodes.pyindex 12f4b6391..aaa4f87a3 100644--- a/nodes.py+++ b/nodes.py@@ -301,17 +301,35 @@ class LatentComposite:"samples_from": ("LATENT",),"x": ("INT", {"default": 0, "min": 0, "max": 4096, "step": 8}),"y": ("INT", {"default": 0, "min": 0, "max": 4096, "step": 8}),+ "feather": ("INT", {"default": 0, "min": 0, "max": 4096, "step": 8}),}}RETURN_TYPES = ("LATENT",)FUNCTION = "composite"CATEGORY = "latent"- def composite(self, samples_to, samples_from, x, y, composite_method="normal"):+ def composite(self, samples_to, samples_from, x, y, composite_method="normal", feather=0):x = x // 8y = y // 8+ feather = feather // 8s = samples_to.clone()- s[:,:,y:y+samples_from.shape[2],x:x+samples_from.shape[3]] = samples_from[:,:,:samples_to.shape[2] - y, :samples_to.shape[3] - x]+ if feather == 0:+ s[:,:,y:y+samples_from.shape[2],x:x+samples_from.shape[3]] = samples_from[:,:,:samples_to.shape[2] - y, :samples_to.shape[3] - x]+ else:+ s_from = samples_from[:,:,:samples_to.shape[2] - y, :samples_to.shape[3] - x]+ mask = torch.ones_like(s_from)+ for t in range(feather):+ if y != 0:+ mask[:,:,t:1+t,:] *= ((1.0/feather) * (t + 1))++ if y + samples_from.shape[2] < samples_to.shape[2]:+ mask[:,:,mask.shape[2] -1 -t: mask.shape[2]-t,:] *= ((1.0/feather) * (t + 1))+ if x != 0:+ mask[:,:,:,t:1+t] *= ((1.0/feather) * (t + 1))+ if x + samples_from.shape[3] < samples_to.shape[3]:+ mask[:,:,:,mask.shape[3]- 1 - t: mask.shape[3]- t] *= ((1.0/feather) * (t + 1))+ rev_mask = torch.ones_like(mask) - mask+ s[:,:,y:y+samples_from.shape[2],x:x+samples_from.shape[3]] = samples_from[:,:,:samples_to.shape[2] - y, :samples_to.shape[3] - x] * mask + s[:,:,y:y+samples_from.shape[2],x:x+samples_from.shape[3]] * rev_maskreturn (s,)class LatentCrop: