〽️ Image Ops Clamp
Keep pixels inside bounds — the 30-second fix for blown-out values
- image
- mask
- image
- mask
ImageOps Clamp does one thing: force every pixel value into a range you specify. min_v is the floor, max_v is the ceiling, and anything outside gets snapped to the nearest bound. It's the node equivalent of clipping audio - boring until something in your pipeline produces values you weren't expecting, and then it's the difference between a clean image and one with garbage in it. It comes from the ComfyUI-Majoor-ImageOps pack.
Why you'd need this
A lot of ComfyUI image processing happens in float space, and not every node respects the 0–1 range you assume. Add a few blend operations in a row - especially additive blends or strong contrast pushes - and pixels can wander above 1.0 or below 0.0. Most of the time you never see it, because some downstream node clamps quietly. But the moment a node doesn't, you get hot highlights that turn to solid white, or shadows that crater, or a channel that goes negative and corrupts a later math step.
That's the niche: put a Clamp right after a chain of aggressive operations and guarantee the handoff is clean. It's also a legitimate creative tool - clamping to a narrow band like 0.3–0.7 is a cheap way to crush an image toward flat grey for a specific look, though you'd normally do that with levels instead.
The controls
min_v- floor, range −1.0 to 1.0. Set 0 to stop negatives.max_v- ceiling, range 0.0 to 2.0. Set 1 to stop blowouts.invert_maskand the optionalmask- clamp only part of the image, with the mask output handed back for free. Useful if you want to tame just the sky or just the highlights.bypass- pass the image through untouched for A/B.
Outputs are image and mask, both matching the input batch. Batch-first, like everything in this pack, so a whole clip clamps in one pass.
Install
ComfyUI Manager (search "ComfyUI-Majoor-ImageOps"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/MajoorWaldi/ComfyUI-Majoor-ImageOps
Restart and hard-refresh the browser (Ctrl+F5 / Cmd+Shift+R). No models, no extra deps - plain torch.
The honest take
This is a thin node and it knows it. If you're only ever piping images between standard ComfyUI nodes, you may never touch it. But the moment you start doing serious multi-pass compositing - the kind of thing this pack is built to enable - you'll be glad it's a double-click away instead of a hand-rolled clamp expression. Think of it less as a node you use often and more as insurance you keep in the graph.
One thing worth knowing: min_v can go negative, which means clamping away from zero. If you're working with data that legitimately lives outside 0–1 (depth, displacement maps, some normal maps), the extended range is intentional - you're not fighting the node, it's built for that.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| bypass | BOOLEAN | false | — |
| min_v | FLOAT | 0.00-10–10 | Minimum output value. Values below this are clamped up. |
| max_v | FLOAT | 1.00-10–10 | Maximum output value. Values above this are clamped down. |
| invert_mask | BOOLEAN | false | — |
| imageopt | IMAGE,VIDEO | Images/Video input. Accepts IMAGE batches and VIDEO frame sources. | |
| maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |