04 Easy Save Image
Getting renders out of the graph and into storage
- session
- image
- json
- document_id
- field_path
- refresh
- created_new_document
04 Easy Save Image takes a ComfyUI IMAGE tensor and stores it inside a ZMongo collection, attached to a document. It's the pack's answer to "save this render so the database is my asset store instead of a folder of PNGs." If the ZMongo pitch - no cluttered storage folders, no lost files when you scale across machines - appeals to you, this is the node that makes it real.
It's called "Easy" because it hides the storage mechanics: you hand it an image and a collection name, and it handles the encode-and-store dance, whether you're on the hosted API or the Local File Store backend.
How it works
Required inputs:
session- from the API Key Session node.image- theIMAGEtensor from your VAE decode (or anywhere else images flow).collection_name- defaults toimages.field_path- defaults toimage_data; the field inside the document that holds the image bytes.filename- defaults tocomfy_image.png; metadata for the stored image.
Optional inputs let you attach it to an existing record: document_id (store into a specific document), doc_key, and metadata_json (arbitrary JSON to stash alongside, like generation params).
Outputs:
json- the backend response.document_id- the document the image landed in; empty if it was created fresh and the response didn't surface an id.field_path- echoes back the field used (handy for chaining).refresh- dirty token to trigger downstream refresh.created_new_document- boolean;trueif this save made a new document rather than updating an existing one. Useful if you want to branch on "did I just add a row?"
How the storage works
Images go in as a binary "bytes envelope" - a JSON object that wraps the encoded image data - rather than as a raw blob that would blow past value-size limits. On the hosted backend it's a save_value/create_doc call with that envelope; in Local File Store mode the node writes the PNG bytes to disk and keeps a lightweight path record in the JSON document instead. Both modes round-trip with 04 Browse Collection Images, so you can save with one node and view with another.
Tips
- Omit
document_idand each save makes a new document - great for an image journal, where every render is its own record. Provide a stabledocument_idand repeated runs overwrite the image in place. metadata_jsonis where the magic lives for a "prompt library with previews" workflow: stash the positive/negative/seed/sampler alongside the render.
Install
ComfyUI Manager → ComfyUI-ZMongo, or:
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
then restart. This node pulls in pillow/numpy on top of the API session - the rest of the pack's heavy requirements.txt (langchain, sentence-transformers, etc.) is installed too, so give the first import a moment.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| image | IMAGE | — | |
| collection_name | STRING | images | — |
| field_path | STRING | image_data | — |
| filename | STRING | comfy_image.png | — |
| document_idopt | STRING | — | |
| doc_keyopt | STRING | — | |
| metadata_jsonopt | STRING | {} | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| json | STRING | — |
| document_id | STRING | — |
| field_path | STRING | — |
| refresh | STRING | — |
| created_new_document | BOOLEAN | — |