Nodes/ComfyUI-ppm/LatentOperationTonemapLuminance
ComfyUI Node

LatentOperationTonemapLuminance

Tame blown-out highlights in latent space

By pamparamm·Created 2 years ago·Updated a day ago· 265
LatentOperationTonemapLuminance
    • LATENT_OPERATION
    tonemappermobius
    multiplier1.00

    Some workflows produce images where the bright parts just clip - skies go pure white, highlights lose all detail, everything looks like it was shot into the sun. Tonemapping is the photographer's answer to that: compress the highlights so the bright range keeps some texture. This node does it in latent space, during sampling, by luminance - so instead of fixing a blown-out image after the fact, it stops it from blowing out in the first place.

    What it is and how it fits

    It's a LATENT_OPERATION, which is ComfyUI's little plug-in mechanism for "do some math to the latent." The node itself doesn't touch your image directly - it produces an operation that you feed into one of ComfyUI's apply nodes, most usefully LatentApplyOperationCFG. Wired that way, the tonemap runs on the guided prediction at every step, gently rolling off the highlights as the image forms. Think of it as an in-loop HDR-to-SDR curve rather than a post-process filter.

    Why luminance specifically? Because you want to compress brightness without wrecking hue. Tonemapping by luminance rolls off how bright a region is while leaving its color relationships intact, so you get detail back in the highlights without the whole image going flat or shifting color. It's a close cousin of ComfyUI's built-in LatentOperationTonemapReinhard - same family of idea, different curve.

    The inputs that matter

    There are only two, which is refreshing:

    • tonemapper (default mobius) - which tone curve to apply. Möbius is a soft, filmic roll-off that holds midtones and eases the highlights down gradually, which is why it's the default and a good place to start.
    • multiplier (default 1) - how hard the effect pushes. 1.0 is the baseline; raise it for more aggressive highlight compression, lower it toward 0 for a barely-there touch. This is the knob you'll actually move.

    Output is a single LATENT_OPERATION. It needs a home - connect it to LatentApplyOperationCFG (feed that your model/sampler guidance) so the tonemap acts during generation.

    Install

    No models, no heavy dependencies - pure latent math.

    • ComfyUI Manager: search "ComfyUI-ppm", install, restart.
    • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/pamparamm/ComfyUI-ppm, then restart.

    Common issues & troubleshooting

    Nothing happens. The most common mistake: leaving the operation dangling. This node only describes an operation - if you don't wire its LATENT_OPERATION output into an apply node like LatentApplyOperationCFG, it does nothing. That's the fix nine times out of ten.

    The whole image goes flat / washed out. You've pushed multiplier too high and compressed the highlights into the midtones. Back it off toward 1.0. Tonemapping is a roll-off, not a "make it darker" slider - overdo it and you kill the contrast you wanted to keep.

    It's a highlight tool, not a color fixer. If your image is washed out and grey across the board, that's usually a VAE or CFG problem, not tonemapping. This node is for the specific case of blown, clipped bright regions. Diagnose the actual cause before reaching for it - if high CFG is burning your image, lowering CFG or using a rescale/dynamic-thresholding node addresses the root, and this smooths what's left.

    Pack rule from the author: if the node errors after a pack update, delete it and re-add it to the graph.

    Categorylatent/advanced/operations

    Inputs (2)

    NameTypeDefaultDescription
    tonemapperCOMBOmobius3 options: reinhard, mobius, aces
    multiplierFLOAT1.000–100

    Outputs (1)

    NameTypeDescription
    LATENT_OPERATIONLATENT_OPERATION