CPA Frame
One Frame Out of a Batch, and Why the Picker Needs It
- images
- image
Twenty-odd nodes in this pack do serious work: track a subject through a shot, render a generative matte, rebuild colour in soft edges. CPA Frame does none of that. It takes a batch of images, an index, and returns one frame. That's the whole node.
Its reason to exist is that SAM 3's text detection and point segmentation - the two operations behind the picker's click and its Find box - work on a single image. Everything else in the pipeline is a sequence. So there needs to be a node that says "this one".
What it does, precisely
images is the batch, index is which frame. The index is clamped to [0, N-1] rather than trusted, so an out-of-range value slides to the last frame instead of throwing - a small mercy when the picker's frame number and the batch's indices disagree by one.
Output is image: a single-frame IMAGE in float32, clamped to 0–1. Note that this node re-casts to float even if it's been handed the pack's uint8 plate - the detection path wants normal float imagery, and one 1080p frame at float32 is nothing.
Where it's used
Two places, both in service of the interface:
Detect. You type person in the Find box; the generator runs SAM 3 text detection on one frame; CPA DetectReport turns the matches into overlay boxes. The frame SAM 3 sees comes through this node.
Click preview. You alt-click a hand to cut it, or shift-click a prop to add it. SAM 3 segments that point on the frame you clicked, and CPA PartReport shows you the resulting mask. Again, one frame, via this node.
Neither path contributes anything to the render. Run a full shot without ever clicking Detect and CPA Frame may never execute at all. That's the shape of most UI-support nodes in ComfyUI: they exist for the moment you're deciding, not for the moment you're rendering.
Why not just index with a core node?
You can - ComfyUI has image-batch utilities, and several packs ship a "select frame" node. The reason this pack has its own is the same reason it has its own everything: every stage is a cached node in a graph the main node builds, and the cache key has to be right. A core node would work fine; an extra dependency on another pack's node wouldn't.
If you're plumbing it by hand - and honestly, for this one there's no reason to - the obvious use is pulling a reference frame out for comparison or for a Save Image check:
CPA Plate ──plate──► CPA Frame ──image──► Preview Image
index: 0
Install
Ships with the pack, no models, no Python dependencies of its own:
cd ComfyUI/custom_nodes
git clone https://github.com/rik-python/ComfyUI-Comfy-Pro-Alpha-Generator.git
pip install -r ComfyUI-Comfy-Pro-Alpha-Generator/requirements.txt
Restart ComfyUI afterwards. The node is /internal and flagged deprecated, so it won't appear in the node menu - it shows up in the graph the Comfy Pro Alpha Generator expands on Queue, and nowhere else.
The one thing that goes wrong
Off-by-one on index. Frames in a ComfyUI batch are 0-based; frame numbers on a plate are whatever the file naming says - 1001 for a VFX plate, 1 for a rendered sequence. The pack keeps the two straight through Load Plate Sequence's first_frame output and the picker's stored frame index, and this node only ever sees the 0-based one.
Which is also why the clamping is there: if the two ever disagree by one, you get the wrong frame rather than a crash, and the wrong frame means a detection overlay on the wrong image - confusing, but recoverable. If your Detect boxes look like they belong to the next frame over, that's the thing to check.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| index | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |