Nodes/LF Nodes/Contrast
ComfyUI Node

Contrast

Midpoint control and local edge contrast, not a blunt slider

By lucafoscili·Created 2 years ago·Updated 2 years ago· 50
Contrast
  • image
  • ui_widget
  • image
  • image_list
contrast_strength0.25
midpoint0.50
localized_contrastfalse

A flat image is the most common complaint after a generation - models love to render things gray and washed. The naive fix is a contrast slider, and the naive slider is why so many people over-crank it into crunchy black-and-white messes. LF_Contrast is the LF Nodes version that gives you control instead of a sledgehammer, and the two knobs that matter are the midpoint and the local-contrast toggle.

  • contrast_strength - −1 to 1, default 0.25. Note the tooltip's framing: 1.0 is no change, below 1 reduces contrast, above 1 increases it. So 0.25 sits slightly on the increase side of "normal," and to actually boost contrast you go toward 1 (or you read it as: negatives soften, positives punch).
  • midpoint - 0 to 1, default 0.5. This is the tonal anchor the contrast pivots around. Leave it at 0.5 for a general punch-up; move it up or down to aim the adjustment at the highlights or the shadows.
  • localized_contrast (optional) - when on, applies contrast "locally to edges and textures" rather than globally. That's the texture-preserving setting: it gives you the snap of higher contrast on fine detail without flattening the overall tonal range.

How it fits

Standard LF filter behavior: accepts a batch or single tensor, returns image and image_list, and renders a KUL_COMPARE before/after widget on the node. Pipeline placement: right after a sampler to fix flatness, or before an upscaler to give it more defined edges to work with.

The realistic workflow: your render comes out muddy → contrast 0.4–0.5, localized_contrast on, midpoint 0.5 → the image gains depth and texture snap without turning into a poster. Compared to the pack's LF_Clarity (which does midtone contrast plus sharpening), this is the pure tonal control; clarity is for when you want the crispness too.

Installing it

Standard LF Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/comfyui-lf

or ComfyUI Manager → LF Nodes → install → restart. No dependencies, no models. The pack is the frozen legacy repo (the author moved active development to lf-nodes), so this node is stable and unchanged.

Where people get burned

  • The 1.0-means-no-change convention trips everyone once. A value of 0.25 is not "25% of max punch" - it's a small bump past normal. Don't multiply by 4 trying to reach max; just watch the compare widget.
  • Over-cranking with localized_contrast off flattens the image - global contrast up too high kills your shadow and highlight separation. If it looks posterized, back off and turn localized on.
  • Stacking this on top of LF_Clarity double-applies midtone work. Use one or the other unless you really know what you're doing.

For fixing the "why is everything gray" problem with actual control, this is the node.

Category✨ LF Nodes/Filters

Inputs (5)

NameTypeDefaultDescription
imageIMAGEInput image tensor or a list of image tensors.
contrast_strengthFLOAT0.25-1–1Controls the intensity of the contrast adjustment. 1.0 is no change, below 1 reduces contrast, above 1 increases contrast.
midpointFLOAT0.500–1Defines the tonal midpoint for contrast scaling.
localized_contrastoptBOOLEANfalseApply contrast enhancement locally to edges and textures.
ui_widgetoptKUL_COMPARE[object Object]

Outputs (2)

NameTypeDescription
imageIMAGE
image_listIMAGE