Comfy-Org / Comfy-Org/ComfyUI

Request/suggestion: Adding more blend modes to Image Blend (Luminosity and Colorize)

Open
#2,444 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

I use ComfyUI to colorize photos and to get a better result I need to combine Hue and Saturation of the output with the Luminance of the input image. So far I do it with an .exe made in .NET but it would be much nicer to handle it in ComfyUI.

It should be rather easy but I don't know Python libraries. I was pointed to **kornia** (K.color.rgb_to_hls) but it seems it's not included within Comfy because the code below does not work.

**nodes_post_processing.py**
```
elif mode == "difference":
return img1 - img2
elif mode == "luminosity":
img1_hls = K.color.rgb_to_hls(img1)
img2_hls = K.color.rgb_to_hls(img2)
combined_image_hsl = torch.cat([img1_hls[:, :1, :, :], img2_hls[:, 1:, :, :]], dim=1)
combined_image_rgb = K.color.hls_to_rgb(combined_image_hsl)
return(combined_image_rgb)
else:
raise ValueError(f"Unsupported blend mode: {mode}")

```

What is the easiest way to do it?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.