Nodes/MdColorMod/Color Levels (MD)
ComfyUI Node

Color Levels (MD)

Levels, the histogram tool that fixes more than you'd think

By MdONeilsl·Created 2 months ago·Updated 2 months ago· 0
Color Levels (MD)
  • image
  • mask
  • image
ChannelValue
InterpolationNon-Linear
Input_low0
Input_high255
Input_gamma1.00
Input_clampfalse
Output_low0
Output_high255
Output_clampfalse
Auto_inputfalse

Levels is the most powerful single node in this pack, and also the one with the most intimidating input list. mdColorLevels is GIMP's Levels tool - the histogram-based remap - with per-channel control, gamma, clamping, and an auto option. Learn it once and it quietly replaces half of your other color nodes.

What levels actually does

A levels adjustment maps an input range to an output range using three things: an input low/high (which pixels count as "black" and "white"), a gamma (the midtone curve between them), and an output low/high (what those extremes map to). Underneath it's a per-pixel transfer function - fully deterministic, instant, no model. The classic move: an image whose histogram doesn't touch the edges (all tones in the middle) is "flat." Set input low/high to the histogram's real edges and the image instantly gains contrast - that's the manual version of the auto-stretch node in this pack, with far more control.

The inputs that matter

Most of the list is one concept applied in two places:

  • Channel - Value (luminance, the default and the one you'll use 90% of the time), or Red/Green/Blue for per-channel work, or Alpha if you want to adjust transparency.
  • Input_low / Input_high (0-255) - the "black point" and "white point." Dragging Input_low up crushes shadows; dragging Input_high down compresses highlights.
  • Input_gamma (0.1-10) - the midtone curve. Above 1 lifts midtones, below 1 darkens them. This is the "brighten without blowing highlights" control.
  • Auto_input - computes Input_low/high from the image's actual histogram. The lazy correct way to start; then refine by hand.
  • Output_low / Output_high, Interpolation (Linear / Non-Linear / Perceptual), and the two clamp toggles are the fine print - leave them at defaults until you have a specific reason.
  • image in, image out, optional mask.

How it beats the alternatives

Where brightness/contrast is a blunt offset+pivot, levels gives you exact control over which tones move. Crush shadows with Input_low, lift midtones with gamma, and your highlights barely move. It's also the correct tool for the "histogram is clipped" problem - the washed-out render where everything lives between 0.3 and 0.7. Our post-processing notes list gamma and sigmoid as the fixes for "flat," and levels is the multi-purpose form of exactly that. Per-channel levels (Channel → Red) is how you fix a color cast by hand when auto white balance overshoots.

Installing

Standard:

cd ComfyUI/custom_nodes
git clone https://github.com/MdONeilsl/ComfyUI-MdColorMod

or ComfyUI Manager → "MdColorMod", restart. Empty requirements.txt, pure torch, no downloads, GPL-3.0. New pack with a thin footprint - the manual clone always works if Manager can't see it.

Categorymd/image/color

Inputs (12)

NameTypeDefaultDescription
imageIMAGEInput image tensor.
ChannelCOMBOValueWhich channel to apply the levels adjustment.
InterpolationCOMBONon-LinearType of interpolation for the level mapping.
Input_lowFLOAT00–255Lower bound for input levels (0-255).
Input_highFLOAT2550–255Upper bound for input levels (0-255).
Input_gammaFLOAT1.000.1–10Gamma correction applied to the input range.
Input_clampBOOLEANfalseClamp input values to the specified range before mapping.
Output_lowFLOAT00–255Lower bound for output levels (0-255).
Output_highFLOAT2550–255Upper bound for output levels (0-255).
Output_clampBOOLEANfalseClamp output values to the specified range after mapping.
Auto_inputBOOLEANfalseAutomatically determine input low/high from image content.
maskoptMASKOptional mask to restrict the adjustment area.

Outputs (1)

NameTypeDescription
imageIMAGEThe levels-adjusted image.