ComfyUI Node

Image Levels

Adjust black and white points in ComfyUI

By jamesWalker55·Created 3 years ago·Updated about a year ago· 215
Image Levels
  • image
  • IMAGE
min0.00
max1.00

JWImageLevels is a levels adjustment - the same idea as the input-levels sliders in Photoshop or GIMP. You tell it where black should start and where white should top out, and it remaps everything in between. It's a quick contrast and range tool that lives right in your graph.

The everyday use is fixing a flat or washed-out image. If your image never reaches true black or true white - a common look coming out of some models, or out of a depth/ControlNet preprocessor - pulling the black and white points inward snaps the contrast back. It's also handy on masks and control maps: a soft, grey-ish depth map or line-art can be crushed into something punchier so the sampler reads it more strongly. Any time you think "this needs more contrast" or "the blacks are muddy," this is the node.

What it actually does

It takes your input's min and max as the new black and white points and stretches the tonal range to fit. Pixels at or below min go to black (0); pixels at or above max go to white (1); everything between is remapped linearly across the full range. So min = 0.1, max = 0.9 clips the darkest and brightest 10% and expands the middle - more contrast. Widening them the other way isn't possible here since both are capped at the 0–1 range, but pulling them inward is the whole game.

Note what it doesn't have: there's no midpoint/gamma control. Photoshop's levels give you three sliders; this one exposes just the two endpoints (black and white points). For a lot of quick fixes that's plenty.

The inputs and outputs that matter

  • image (IMAGE) - the image to adjust.
  • min (FLOAT, 0–1, default 0) - the black point. Raise it to crush the darks toward black.
  • max (FLOAT, 0–1, default 1) - the white point. Lower it to push the brights toward white.

At the defaults (0 and 1) the image passes through unchanged. Output is a single IMAGE.

How to install it

Pack: jamesWalker55/comfyui-various. ComfyUI Manager - search Various ComfyUI Nodes by Type, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/jamesWalker55/comfyui-various

then restart. No dependencies. JWImageLevels lives in comfyui_color_ops.py (alongside the pack's contrast, saturation, and mix nodes), so if you'd rather not clone everything, dropping that one file into custom_nodes/ gets you the color tools on their own.

Common issues & troubleshooting

Keep min below max. The node expects black point lower than white point. Setting them equal or inverted (min above max) gives you a degenerate result - a crushed or flipped range - rather than a normal levels adjustment. If your output looks like a broken high-contrast mess, check the ordering.

Defaults do nothing. min = 0, max = 1 is a straight pass-through. If you dropped the node in and see no change, that's why - you haven't moved the endpoints yet.

It's global, not per-channel. This applies one levels curve across the image; it's not a per-RGB-channel color correction. For hue/saturation work, reach for the pack's saturation node instead.

CategoryjamesWalker55

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
minFLOAT0.000–1
maxFLOAT1.000–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE