📊 PS Levels
The humble levels node with an actually useful auto button
- image
- mask
- image
Levels is the workhorse of photo correction: three points - black, midtone, white - that fix flat, washed-out, or clipped images faster than anything else. This node ports Photoshop's Levels panel into ComfyUI, complete with the histogram behind the sliders, per-channel operation, output range control, and - the genuinely useful part - auto levels and auto contrast that do the histogram math for you.
Reach for it first when a render looks washed out or muddy. Most AI output lands with a histogram that hugs the middle, wasting the dynamic range at both ends. One pass through this node stretches the blacks down and whites up and the image snaps into focus, so to speak. It's the classic first move before you bother with curves or color grading; get the range right, then grade.
How it works
The core math is the standard levels remap: input values are normalized between input_black and input_white, gamma is applied through input_midtones, then the result is rescaled into the output_black/output_white range. Compression of the output range (say 20-235) is how you'd prep for print or deliberately soften contrast; expansion does the opposite. You can operate on RGB at once or on a single R, G, B, or Luminance channel - Luminance mode works in HSV space so you adjust brightness without shifting color, which is the right tool for most "just fix the exposure" situations.
The auto buttons are the sleeper feature. auto_levels scans the histogram, clips a small percentage from each end (that's clip_percentage, default 0.1%), and computes the black/white points; auto_contrast does a gentler stretch. Combined with the popup's live histogram, you can see exactly what the auto pass is doing before you commit.
The inputs that matter
channel- RGB (default), R, G, B, or Luminance.input_black/input_white- where the darkest and brightest actual pixels sit.input_midtones- the gamma slider, 0.1 to 9.99 with 1.0 neutral. Watch the direction here: values above 1.0 brighten midtones, below 1.0 darken them - the author maps it the inverse of the "gamma" convention some editors use, so it's a classic place to feel like the node is broken when it's just backwards from your habits.output_black/output_white- the destination range.auto_levels/auto_contrast/clip_percentage- the one-click fixes.
Optional mask / mask_blur (0-20) / invert_mask for targeted correction. Single image output.
Installing it
Same pack, same two paths. ComfyUI Manager → search "ComfyUI-Curve", or:
cd ComfyUI/custom_nodes
git clone https://github.com/aiaiaikkk/ComfyUI-Curve.git
Restart ComfyUI. No model downloads.
Where people get burned
The midtone direction trips everyone at least once - if dragging input_midtones "the wrong way" seems to do the opposite of what you expect, you've found it; the tooltip says it plainly and the code agrees. Second, don't stack auto levels on top of manual point edits - the auto pass recalculates and silently overwrites your input_black/input_white/input_midtones values, so pick manual or auto, not both. And as with any levels work on smooth gradients, aggressive stretching exposes banding; keep clip_percentage small and check a flat area of the image.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| channel | COMBO | RGB | 5 options: RGB, R, G, B, Luminance |
| input_blackopt | FLOAT | 00–254 | 输入黑场点 (0-254) |
| input_midtonesopt | FLOAT | 1.000.1–9.99 | 输入中间调 (0.1-9.99,1.0为中性,<1.0变暗,>1.0变亮) |
| input_whiteopt | FLOAT | 2551–255 | 输入白场点 (1-255) |
| output_blackopt | FLOAT | 00–254 | 输出黑场点 (0-254) |
| output_whiteopt | FLOAT | 2551–255 | 输出白场点 (1-255) |
| auto_levelsopt | BOOLEAN | false | 自动色阶调整 |
| auto_contrastopt | BOOLEAN | false | 自动对比度调整 |
| clip_percentageopt | FLOAT | 0.10–5 | 自动调整时的裁剪百分比 |
| maskopt | MASK | 可选遮罩,调整仅对遮罩区域有效 | |
| mask_bluropt | FLOAT | 0.00–20 | 遮罩边缘羽化程度 |
| invert_maskopt | BOOLEAN | false | 反转遮罩区域 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |