Levels (HSV)
Rebalance the light without desaturating a single pixel
- image
- mask_opt
- image
Levels (HSV) is the three-knob tonal editor of the pack's HSV half: it clips shadows, sets a gamma curve for the midtones, and clips highlights - all on the value channel of an HSV conversion. And that last detail is the whole reason this node exists. If you ran the same adjustment in HSL, the darkening would drag colors toward black and gray them out. HSV Levels darkens a scene while keeping every color as saturated as it was, which is exactly what you want for "a glowing haunted house in the dead of night" where the house should still read as red, not murky brown.
How it works
Convert to HSV, run the value channel through the classic three-step levels pipeline, convert back. First, brightness below shadows is clipped to black. Then the remaining range is rescaled and a gamma curve - the midtones value - shapes the middle. Finally, brightness above highlights clips to white. The gamma direction is the standard gotcha: pow(brightness, midtones) means midtones above 1 darken the mids and below 1 lightens them (the README's "above 1 darkens, below 1 brightens" - note it's phrased oppositely from the HSL section, but it's the same math, so don't get cross-eyed comparing the two).
The inputs that matter
shadows(default 0, range 0–1) - brightness below this crushes to black.midtones(default 1, range 0–100) - the gamma curve. 1 is neutral; below 1 lifts the mids; above 1 sinks them.highlights(default 1, range 0–1) - brightness above this clips to white; dropping it recovers blown detail.masked_area+ optionalmask_opt- the pack's standard masking.
Output: one image tensor. Only value is touched, so hue and saturation survive untouched - that's the point.
What to watch for
The midtones slider's 0–100 range looks silly next to the 0–1 siblings, but it's just the raw gamma range; real work happens roughly between 0.5 and 2.5, and the wide ceiling is for dramatic crushed looks. And yes, the in-UI description is the pack's usual stale, generic text - ignore it and read the sliders. One more honest note: because this never touches saturation, very deep shadows can keep a lot of color. If you want true blacks, either lower the shadows clip harder or pair it with a Desaturate.
Installing it
ComfyUI Manager → search "Basix Image Filters" (repo basix_image_filters) → install → restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/maludwig/basix_image_filters
Restart after. No models, no downloads, no heavy dependencies - pure torch math.
Using it well
This is a graded hint machine. The README's haunted-house example is the perfect case: darken the value channel of a reference, run it back through the sampler at 0.7–0.9 denoise, and the model reproduces the darker-but-still-colorful lighting instead of re-adding its default even illumination. For partial control - darken the house, leave the sky - mask_opt with a MaskEditor mask and the masked_area toggle handle it in one pass.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| masked_area | BOOLEAN | true | — |
| shadows | FLOAT | 0.00–1 | — |
| midtones | FLOAT | 1.00–100 | — |
| highlights | FLOAT | 1.00–1 | — |
| mask_optopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |