Nodes/ComfyUI Impact Pack/Remove Image from SEGS
ComfyUI Node Runs on cloud

Remove Image from SEGS

Undo a SEGS's baked-in image

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
Remove Image from SEGS
  • segs
  • SEGS

A SEGS object can carry its own cropped image data - set either by SEGSDetailer after it's processed a region, or explicitly by Set Default Image For SEGS. Most of the time that's convenient: downstream nodes have an image to work with without needing a fallback. Remove Image from SEGS does the opposite - it strips that image back out, so whatever detects it next has to fall back to the currently processed image instead of the one baked into the SEGS.

It's a small, single-purpose node, and per the README it's specifically the undo for the two ways an image gets attached in the first place: "Remove the image set for the SEGS that has been configured by 'Set Default Image for SEGS' or SEGSDetailer."

Why you'd want this

The usual reason is a multi-stage pipeline where the image inside a SEGS goes stale. Say a first SEGSDetailer pass refines a region and stores the result inside the SEGS. If you then run more processing on the whole image - another detail pass, a compositing step, anything that changes pixels outside that region - and want a second detailer downstream to work from the current, freshly-processed frame rather than the stale image trapped inside the SEGS from the first pass, you strip it here first. Without that, the second detailer would keep working from an outdated snapshot instead of your actual current image, and you'd be detailing on top of pixels that no longer exist in the final composite.

The input and output

  • segs (SEGS, required) - the detections whose attached images you want cleared.

Output is a single SEGS - same detections, same masks and crop regions, image data removed. Nothing about the detections themselves changes; this is purely about which image a downstream node falls back to.

How to install it

Via ComfyUI Manager: search ComfyUI Impact Pack, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack comfyui-impact-pack
cd comfyui-impact-pack
python -m pip install -r requirements.txt   # ComfyUI's python; python_embeded on portable

then restart. No models, no extra dependencies - this node only touches metadata inside the SEGS object.

Common issues & troubleshooting

Not sure whether your SEGS even has an image attached. If it went through SEGSDetailer or Set Default Image For SEGS, it does. If it came straight from a plain detector node (BBOX Detector (SEGS), SEGM Detector (SEGS)), it usually doesn't yet - this node would be a no-op in that case, since there's nothing to strip.

Downstream node still seems to be using an old image after this node. Confirm this node is genuinely wired in between the stale SEGS and whatever consumes it next, and that a fallback_image_opt on the consuming node (SEGSPreview and similar accept one) points at the current image, not another stale one. Removing the SEGS's image doesn't help if the fallback you're supplying is itself outdated.

Do you need this at all? Only in multi-stage pipelines where a SEGS's baked-in image can go stale relative to the rest of your workflow. In a simple single-pass detect-then-detail-then-paste chain, there's nothing to clear and this node has no job to do.

CategoryImpactPack/Util

Inputs (1)

NameTypeDefaultDescription
segsSEGS

Outputs (1)

NameTypeDescription
SEGSSEGS