Nodes/comfyui_sunxAI_facetools/Save Image Websocket New To JPG
ComfyUI Node

Save Image Websocket New To JPG

Previews that never touch your disk

By upseem·Created about a year ago·Updated 11 months ago· 15
Save Image Websocket New To JPG
  • images
    jpeg_quality95

    The name is doing a lot of work here, but once you unpack it the node is simple: "Save Image Websocket New To JPG" does not save anything. It takes an image, compresses it to JPEG in memory, and pushes it over ComfyUI's websocket to the frontend. No file lands in your output folder. That's the entire trick, and if you know why you need that, it's a useful one.

    What it's for. ComfyUI talks to its frontend over a websocket, and preview nodes use that channel to stream images to the browser. This node from the comfyui_sunxAI_facetools pack (Sunx.ai) rides the same channel deliberately. Its natural home is a custom backend: an API server or bot built on ComfyUI that wants the generated image returned to the client over the socket - small, fast, lossy JPEG - instead of having to poll a file on disk afterward. It's also handy when you're running a batch in the browser and don't want thousands of frames cluttering ComfyUI/output. You get the preview, the disk stays clean.

    How it works. For each image in the batch it does the PIL dance: convert to uint8, JPEG-compress into a BytesIO buffer at your chosen quality, then hand the compressed frame to ComfyUI's progress-bar/preview mechanism as a ("JPEG", image, None) tuple, which is what gets pushed over the socket. The node also marks itself as always-changed (its change-check returns the current time), so it re-fires every run rather than being cached as a no-op. It catches per-image errors and skips the bad frame instead of killing the whole batch.

    The inputs. Just two:

    • images - the IMAGE tensor you want previewed
    • jpeg_quality - an integer from 60 to 100, default 95. The author's own tooltip: "JPEG compression quality (60 = low quality, 100 = high quality)." 95 is a fine preview default; drop it toward 60 if you're streaming a lot of frames over a slow link.

    Where people get burned. The obvious one: you plug it in expecting a saved file and find nothing in your output folder. That's not a bug - it never writes. If you want the file, use the normal Save Image. Second gotcha: JPEG is lossy, and even at 95 it's not an archival format. This is a preview/transfer node, not your final-output path; keep a lossless save elsewhere if you care. And third, "over the websocket" only means something if something is actually listening on the other end - in the plain desktop UI it behaves like a glorified preview node, which is fine, but its real value shows up when you're building a client that consumes those socket messages.

    Install. It comes with the pack, so you can't grab it alone: ComfyUI Manager → search comfyui_sunxAI_facetools → install → restart, or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/upseem/comfyui_sunxAI_facetools
    

    Then restart ComfyUI. The pack drags in a genuinely heavy dependency set - insightface, onnxruntime, ultralytics, mediapipe, transformers - most of which you don't need for a preview node, but they come with the package. InsightFace is the one most likely to fight you on Windows.

    If you just want a normal output file, reach for stock Save Image. If you're serving images over the socket, this is the node the pack author clearly built that for.

    CategorysunxAI_facetools

    Inputs (2)

    NameTypeDefaultDescription
    imagesIMAGE
    jpeg_qualityINT9560–100JPEG压缩质量(60=低质量,100=高质量)

    Outputs (0)

    No outputs