Painter Frame Extractor
Pull two frames out of any video batch
- image
- start_image
- end_image
- image1
- image2
- image1_idx
- image2_idx
In ComfyUI, a video isn't a video - it's an IMAGE tensor where the first dimension is frames. That's fine until you need "the frame at 3 seconds" and find yourself fumbling with indexing math. PainterFrameExtractor is the node that pulls exactly the two frames you want out of an image sequence, and as a bonus hands you the first and last frame of the batch. If you've ever needed a start frame and an end frame for an FLF or loop workflow, this is the clean way to get them.
What it is
A small image/batch utility. You feed it an IMAGE (a video clip or image batch) and two indices, image1_idx and image2_idx, and it returns six outputs:
start_image- the first frame of the batchend_image- the last frame of the batchimage1/image2- the frames at your chosen indicesimage1_idx/image2_idx- the indices echoed back
The index echoes are the quietly useful part: wire them forward into nodes that need to know where a frame came from, so downstream conditioning stays in sync with what you actually extracted.
How it works
The mechanism is reassuringly boring. It looks up the frame count, clamps both indices into range (max(0, min(idx, total-1))), and slices single frames out. Clamping means an out-of-range index doesn't crash - you just get the last frame instead of an error, which is the good kind of forgiving. Negative indices aren't treated as "from the end," so remember 0 is the first frame and indexing starts at zero like the rest of ComfyUI.
Where you'd use it
The obvious pattern is FLF and loop work: feed a rendered clip or an existing video in, grab start_image and end_image, and drop them into an FLF2V-style builder to re-generate between them. The other common pattern is chaining - take frame 0 and frame 80 of a sequence you like and reuse them as anchors for a longer, re-diffused take. If you mostly want the two ends, this node gives them to you without touching the middle.
Install
Ships in the PainterNodes pack. ComfyUI Manager → search "PainterNodes" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/princepainter/ComfyUI-PainterNodes
cd ComfyUI-PainterNodes
pip install -r requirements.txt
Dependencies are just soundfile and numpy; the pack never downloads models by itself.
Common issues
- "Wrong" frame returned - check the index bases. ComfyUI is zero-indexed, and this node clamps rather than errors, so an index past the end silently returns the last frame. If you meant "frame at 3 seconds" you still need to convert seconds × fps yourself.
- Indexes that should count from the end - there's no negative-index support here. If you need the second-to-last frame, use the
end_imageoutput or compute the index externally.
It's a tiny node, and it won't change your life. But when you're three nodes deep into a video graph and need the two ends of a clip as clean images, it's the difference between a wire and a headache.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| image1_idx | INT | 00–99999 | — |
| image2_idx | INT | 00–99999 | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| start_image | IMAGE | — |
| end_image | IMAGE | — |
| image1 | IMAGE | — |
| image2 | IMAGE | — |
| image1_idx | INT | — |
| image2_idx | INT | — |