Nodes/ComfyUI-XJNodes/SEGS Sharpen Hook
ComfyUI Node

SEGS Sharpen Hook

Unsharp-mask the detail pass before it lands

By alexjx·Created 10 months ago·Updated 4 months ago· 0
SEGS Sharpen Hook
    • hook
    radius2
    strength1.50
    feather0

    Detail passes exist to make small regions crisper, but the sampler's idea of "crisper" isn't always the same as a good sharpening pass - sometimes the decoded crop comes back with soft edges that need a nudge, sometimes it comes back over-sharp and needs restraint. XJSegsSharpenHookProvider is the hook that applies a proper unsharp mask to the crop after the detail pass decodes, before it's pasted back into the image. It's the sharpening equivalent of the pack's Blur Hook - same machinery, opposite direction.

    The mechanism is textbook unsharp masking: blur a copy of the image, then add strength × (original − blurred) back to the original. That formula is why the edge of the mask sharpens while flat areas stay untouched - unsharp masking enhances contrast only where there's already contrast, so it rarely adds that nasty "everything is crunchy" look a naive sharpen filter produces. radius sets the blur kernel size (the scale of detail being sharpened), and strength sets the amount (up to 8.0 in this node, which is a lot - you'll almost never go that high). And as with the other hooks in this family, when a segment mask is available the effect stays inside the masked region, with feather controlling the softness of that boundary.

    The interface:

    • radius - 1–25, default 2. Detail scale; small radius sharpens fine detail, larger radius catches broader edges.
    • strength - 0–8, default 1.5. The unsharp amount.
    • feather - 0–100, default 0. Edge softness of the masked effect.
    • Output: hook, into detailer_hook on FaceDetailer / Detailer (SEGS).

    Where it fits: when the detailer's output is technically correct but renders soft - a low-denoise pass that barely changes the crop can leave it looking like a watercolor. A light sharpen (radius 2, strength 1.0–1.5) recovers the crispness without re-sampling. It's also the finishing touch in the two-pass setup where you detail one region and want the subject to pop against a blurred background (which the pack's Blur Hook handles).

    Install is the pack-wide routine:

    cd ComfyUI/custom_nodes
    git clone https://github.com/alexjx/ComfyUI-XJNodes
    

    Restart ComfyUI, find it under XJNodes/segs/hooks, or use ComfyUI Manager and search "ComfyUI-XJNodes". No models, empty requirements.txt, no extra pip packages - Impact Pack just needs to be around for the hook input.

    Personal-pack honesty: no tutorials exist for this node, so the defaults (2 / 1.5) are the author's taste, not a verified best practice. Start there and back strength off to ~1.0 if the region starts to look gritty - over-sharpening reads worse than under-sharpening, especially on faces.

    CategoryXJNodes/segs/hooks

    Inputs (3)

    NameTypeDefaultDescription
    radiusINT21–25
    strengthFLOAT1.500–8
    featherINT00–100

    Outputs (1)

    NameTypeDescription
    hookDETAILER_HOOK