Nodes/ComfyUI-ZMongo/04 Browse Collection Images
ComfyUI Node

04 Browse Collection Images

Your ZMongo store as a contact sheet

By CentralFloridaAttorney·Created 7 months ago·Updated 4 months ago· 2
04 Browse Collection Images
  • session
  • image_batch
  • selected_image
  • json
  • document_ids
  • indexed_document_ids
  • selected_document_id
  • count
  • status
◄collection_nameimages►
◄field_pathimage_data►
◄query_json{}►
◄limit12►
◄skip0►
◄selected_index0►
◄thumbnail_width512►
◄thumbnail_height512►
◄master_key_hex►
◄cachefalse►
◄refresh_token►

04 Browse Collection Images is the reading side of ZMongo's image storage: it pulls saved images back out of a collection and hands them to ComfyUI as tensors you can actually preview, pass to a sampler, or feed to an image-to-image pipeline. Save with 04 Easy Save Image, browse with this. They're the pair that makes the database a real asset library instead of a black box.

The source's docstring is refreshingly concrete about the workflow: use it with ComfyUI's built-in Preview Image node - image_batch shows a grid from the collection/page, selected_image shows the one you picked via selected_index.

How it works

The node lists documents from a collection, decodes each one's image field locally when it can, and falls back to a backend image route when the data is server-side only. No new backend endpoint needed - it reuses the API session.

Required inputs that matter:

  • session - from the API Key Session node.
  • collection_name - defaults to images.
  • field_path - the field holding the image bytes, default image_data.
  • query_json - Mongo-style filter (default {} = everything).
  • limit / skip - paging; limit caps at 64.
  • selected_index - which image in the batch becomes selected_image.
  • thumbnail_width / thumbnail_height - the batch canvas size, default 512×512. Every frame gets letterboxed onto this canvas so the batch is a uniform shape (important - ComfyUI batches need matching dimensions).

Outputs are the richest in the pack:

  • image_batch - all images in the page as one IMAGE tensor.
  • selected_image - the single image at selected_index.
  • json - the raw list-docs payload.
  • document_ids - list of ids on the page.
  • indexed_document_ids - the same ids as a numbered string list ("0: abc", "1: def"), for feeding into selector nodes.
  • selected_document_id - the id of your selected image. This is the gold output: wire it into a Get Doc or a Gemini-from-doc node and you've got a full "browse → pick → process" loop.
  • count - how many documents matched.
  • status - human-readable state, useful for debugging.

Gotchas

  • Batch images are letterboxed onto the thumbnail canvas with black bars, so a contact sheet looks tidy but the actual pixels are padded. Preview with selected_image (which is decoded natively) when you care about exact pixels.
  • master_key_hex is an optional decryption key for images stored encrypted server-side - leave blank unless your backend uses it.
  • The cache option exists because listing/decoding can be slow on big collections; a cached browse is fast but can serve stale rows.

Install

ComfyUI Manager → ComfyUI-ZMongo, or clone:

cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo

restart, then let the first import churn through the pack's heavy requirements.txt. The image nodes need pillow/numpy/torch - the rest (langchain, pymilvus, …) is installed but unused here.

CategoryZMongo/04 Images

Inputs (12)

NameTypeDefaultDescription
sessionZMONGO_API_SESSION—
collection_nameSTRINGimages—
field_pathSTRINGimage_data—
query_jsonSTRING{}—
limitINT121–64—
skipINT00–1000000—
selected_indexINT00–1000000—
thumbnail_widthINT51264–4096—
thumbnail_heightINT51264–4096—
master_key_hexoptSTRING—
cacheoptBOOLEANfalse—
refresh_tokenoptSTRING—

Outputs (8)

NameTypeDescription
image_batchIMAGE—
selected_imageIMAGE—
jsonSTRING—
document_ids*—
indexed_document_idsSTRING—
selected_document_idSTRING—
countINT—
statusSTRING—