Nodes/ComfyUI_Camera/Save Image To Local Camera
ComfyUI Node

Save Image To Local Camera

The 'save' that saves to nowhere (and that's the point)

By xuhongming251·Created 2 years ago·Updated about a year ago· 7
Save Image To Local Camera
  • images

    The name is a lie. Save Image To Local Camera doesn't write a file, and it won't create a folder anywhere. What it actually does is push your pipeline's output into shared memory so a separate OpenCV window - titled Processed Preview - can display it live at roughly 30fps.

    It's the second half of the ComfyUI_Camera pack. Load Image From Local Camera is the input side of the loop; this is the sink. You wire your processed result into it, and whatever your graph does to the camera frame shows up in that window in near-real-time. That's how the pack turns "run an image through ComfyUI" into "watch ComfyUI process your webcam feed live."

    How it works

    The node takes your IMAGE tensor, scales it back from 0–1 to 0–255, converts RGB to BGRA, and writes it into a shared-memory block named comfy_to_camera. It uses a double buffer: it writes to one buffer while the other is still being read, then flips an index. That avoids the tearing you'd get if producer and consumer raced over a single frame.

    On the other end, the child process spawned by Start Local Camera (preview_processed.py) reads that block and imshows it in the Processed Preview window, sleeping ~30ms per frame to pace it. If your output resolution changes, the node notices and rebuilds the shared-memory block instead of crashing - which is why the README can honestly claim you can change resolution without restarting.

    The node is marked as an output node, so nothing needs to hang off it. It also ticks ComfyUI's progress bar once per image in the batch, which is a nice touch if you're previewing video frames in bulk.

    Inputs and outputs

    One input, no outputs:

    • images (IMAGE) - the tensor(s) to preview. Usually the output of your sampler's VAE Decode, or straight from the Load node for a passthrough sanity check.

    Because it's a terminal node, you can still attach a normal PreviewImage or Save Image node to the same tensor if you also want the usual in-browser preview or an actual file on disk. They don't conflict.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/xuhongming251/ComfyUI_Camera
    cd ComfyUI_Camera
    pip install -r requirements.txt
    

    Restart ComfyUI afterwards, or install via ComfyUI Manager by searching "ComfyUI_Camera". Dependencies are just opencv-python, numpy, and psutil - no models to download, no GPU requirements beyond what your own graph needs. The child processes run with the same Python as ComfyUI, so make sure opencv lands in that environment.

    Common issues

    • The Processed Preview window never appears. You haven't clicked Start Local Camera, so the reader process was never spawned. Right-click the canvas → Start Local Camera, and it opens alongside the camera's own preview window.
    • The window shows a stale frame. The preview only updates as fast as your graph executes. A slow sampler means freeze-frame lag, not a smooth feed. That's inherent to ComfyUI re-running the whole graph per frame - it's not a bug in this node. Light graphs (low resolution, few steps) keep it feeling live.
    • Nothing shows until you queue. The node only writes when it executes, so it sits idle until the graph runs. Hit Queue Prompt and let it loop.
    • Leaving it running. Use right-click → Stop Local Camera when you're done. It kills the two child processes and cleans up the shared memory so you're not leaking a camera handle.
    CategoryLocalCamera

    Inputs (1)

    NameTypeDefaultDescription
    imagesIMAGE

    Outputs (0)

    No outputs