Nodes/MdColorMod/Color Brightness-Contrast (MD)
ComfyUI Node

Color Brightness-Contrast (MD)

Brightness and contrast the GIMP way — and why it's not Photoshop's

By MdONeilsl·Created 2 months ago·Updated 2 months ago· 0
Color Brightness-Contrast (MD)
  • image
  • mask
  • image
Brightness0.0
Contrast0.0

The most boring node in this pack - and one of the most useful, because it's the one you'll actually wire into every finishing pass. mdColorBrightnessContrast is GIMP's brightness/contrast adjustment with the same -127 to 127 range that GIMP has used for decades. In a ComfyUI graph full of purpose-built nodes, sometimes you just need to lift the whole image half a stop.

The mechanism (and the gotcha hiding in it)

This is where it pays to know your color math. The node uses GIMP's formulas: brightness is applied as an offset that's been scaled into GIMP's internal range, and contrast uses a tan-based slant - slant = tan((contrast/127 + 1) * pi/4) - which pivots the pixel values around mid-gray. Contrast here is a pivot around 0.5, not a simple multiply.

Here's the thing people get burned by: brightness and contrast are not the same operation as gamma. Brightness adds an offset, so it flattens contrast and clips highlights fast - you can see white blow out before the image looks brighter. Gamma is a power curve that lifts shadows without moving white. Our post-processing notes make exactly this point: when an image looks flat, you usually want gamma or a sigmoid, not the brightness slider. Use this node for a quick lift and a touch of contrast; reach for a gamma node when the problem is "the image is flat" rather than "the image is dark."

The controls

  • image - required.
  • Brightness - -127 to 127 offset. Single digits for subtle lifts; past ±30 you're doing something deliberate.
  • Contrast - -127 to 127 pivot around mid-gray. Going negative flattens - occasionally useful to soften a too-harsh render before adding grain.
  • mask - optional, per-pixel strength blend.
  • Output: image, alpha preserved. And a small nicety from the source: if both sliders are zero it returns the input unchanged, so a disabled-by-default node costs you nothing in a workflow.

Fit in a workflow

Post-VAE decode, pre-upscale, next to the other MdColorMod nodes. Because it's per-pixel and deterministic it runs in milliseconds, which is the whole argument for the post-processing layer - this is a $0 fix that a lot of people reach for a re-gen to accomplish. Batch support and automatic VRAM chunking come with the pack.

Installing

Identical to every node here. ComfyUI Manager → search "MdColorMod", or:

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

restart. Empty requirements, pure torch, no models, GPL-3.0, and new enough that if Manager can't see the pack yet, clone it manually. The source also expects a float image tensor - ComfyUI's image tensors are always float, so that's a non-issue in practice, but worth knowing if you feed it something exotic.

Categorymd/image/color

Inputs (4)

NameTypeDefaultDescription
imageIMAGEInput image tensor.
BrightnessFLOAT0.0-127–127Brightness offset (-127 to 127).
ContrastFLOAT0.0-127–127Contrast factor (-127 to 127).
maskoptMASKOptional mask to restrict the adjustment area.

Outputs (1)

NameTypeDescription
imageIMAGEThe brightness/contrast adjusted image.