Nodes/mircudx custom nodes/CC Segment Image Gate
ComfyUI Node

CC Segment Image Gate

The quiet node that stops unused Kling segments from rendering

By mircudx·Created 6 months ago·Updated 6 months ago· 0
CC Segment Image Gate
  • image
  • image_or_block
segment_count1
segment_index1
enabledtrue

Here's the problem this node solves: a workflow built for a 60-second Kling video has six Kling generation nodes, one per 10-second segment. But your script is 20 seconds. Without help, all six nodes render anyway - paying for four clips you never use. CC Segment Image Gate is the pack's answer: it passes the start frame through for segments that exist, and for the ones that don't, it tells ComfyUI to skip everything downstream. No nodes deleted, no re-wiring, no wasted generations.

How it works

The mechanism is ComfyUI's ExecutionBlocker. When a node outputs it, the whole downstream chain of that node is skipped for the run - the graph stays intact, it just doesn't execute. The gate compares segment_index against segment_count: if the segment is within the plan, the image passes through to the Kling node; if not, the gate emits an ExecutionBlocker and the Kling API call for that segment never happens.

Two implementation details make it worth understanding. The image input is lazy - ComfyUI only loads it if the gate is actually active, so a blocked segment doesn't even bother fetching its frame. And the gate returns a plain IMAGE, so it slots between any LoadImage and any image-to-video node, not just this pack's.

The inputs that matter

  • segment_count - how many segments your script actually has. Wire this from the planner/parser rather than hardcoding it; if it's wrong, every gate downstream is wrong too.
  • segment_index - which segment this gate serves. One gate per segment, each hardcoded to its own index.
  • enabled - a master switch. It's on by default; flip it off and the gate always blocks. In the bundled workflows this is how you'd quickly kill the whole Kling chain without deleting nodes.
  • image - the start frame for this segment. When the gate passes it, this is what the Kling node animates from.

The single output, image_or_block, is either the image (active segment) or the blocker (inactive). Wire it into the Kling node's start-frame input.

Where it burns people

The silent-skip trap. If a gate is active but has no image connected - or the image is missing - it emits an ExecutionBlocker with the message "Missing start frame for active segment." The run just... skips that segment. No error box, no red flash. If a segment quietly never appears in your output, check that gate's wiring first, and watch for the case where you increased segment_count but never added a LoadImage to feed the new gate.

The other gotcha is shared with the whole pack: the bundled workflows expect a separate Kling node pack (KlingStartEndFrameNode) to be installed. The gate is the frame keeper, but the actual Kling API calls come from that other pack - install both or the workflow won't import.

Installing it

This node ships in the Auto-Card-Generator pack by mircudx - small, MIT-licensed, zero pip dependencies, no model downloads. Either use ComfyUI Manager (search "Auto-Card-Generator") or:

cd ComfyUI/custom_nodes
git clone https://github.com/mircudx/Auto-Card-Generator

Then restart ComfyUI. If a bundled workflow complains about missing nodes, import the *_local_safe_compat.json variant, which strips helper nodes commonly absent from local installs.

CategoryCard Creator/LLM

Inputs (4)

NameTypeDefaultDescription
segment_countINT11–64
segment_indexINT11–64
enabledBOOLEANtrue
imageIMAGE

Outputs (1)

NameTypeDescription
image_or_blockIMAGE