Nodes/ComfyUI-Curve/📊 PS Levels
ComfyUI Node

📊 PS Levels

The humble levels node with an actually useful auto button

By aiaiaikkk·Created about a year ago·Updated 10 months ago· 181
📊 PS Levels
  • image
  • mask
  • image
channelRGB
input_black0
input_midtones1.00
input_white255
output_black0
output_white255
auto_levelsfalse
auto_contrastfalse
clip_percentage0.1
mask_blur0.0
invert_maskfalse

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.

CategoryImage/Adjustments

Inputs (13)

NameTypeDefaultDescription
imageIMAGE
channelCOMBORGB5 options: RGB, R, G, B, Luminance
input_blackoptFLOAT00–254输入黑场点 (0-254)
input_midtonesoptFLOAT1.000.1–9.99输入中间调 (0.1-9.99,1.0为中性,<1.0变暗,>1.0变亮)
input_whiteoptFLOAT2551–255输入白场点 (1-255)
output_blackoptFLOAT00–254输出黑场点 (0-254)
output_whiteoptFLOAT2551–255输出白场点 (1-255)
auto_levelsoptBOOLEANfalse自动色阶调整
auto_contrastoptBOOLEANfalse自动对比度调整
clip_percentageoptFLOAT0.10–5自动调整时的裁剪百分比
maskoptMASK可选遮罩,调整仅对遮罩区域有效
mask_bluroptFLOAT0.00–20遮罩边缘羽化程度
invert_maskoptBOOLEANfalse反转遮罩区域

Outputs (1)

NameTypeDescription
imageIMAGE