Nodes/ComfyUI-ZMongo/04 Easy Save Image
ComfyUI Node

04 Easy Save Image

Getting renders out of the graph and into storage

By CentralFloridaAttorney·Created 5 months ago·Updated 2 months ago· 1
04 Easy Save Image
  • session
  • image
  • json
  • document_id
  • field_path
  • refresh
  • created_new_document
collection_nameimages
field_pathimage_data
filenamecomfy_image.png
document_id
doc_key
metadata_json{}

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 - the IMAGE tensor from your VAE decode (or anywhere else images flow).
  • collection_name - defaults to images.
  • field_path - defaults to image_data; the field inside the document that holds the image bytes.
  • filename - defaults to comfy_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; true if 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_id and each save makes a new document - great for an image journal, where every render is its own record. Provide a stable document_id and repeated runs overwrite the image in place.
  • metadata_json is 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.

CategoryZMongo/04 Images

Inputs (8)

NameTypeDefaultDescription
sessionZMONGO_API_SESSION
imageIMAGE
collection_nameSTRINGimages
field_pathSTRINGimage_data
filenameSTRINGcomfy_image.png
document_idoptSTRING
doc_keyoptSTRING
metadata_jsonoptSTRING{}

Outputs (5)

NameTypeDescription
jsonSTRING
document_idSTRING
field_pathSTRING
refreshSTRING
created_new_documentBOOLEAN