JSON Image Downloader
Save and zip by output_path
- images
A JSON-driven batch isn't done until the images land where you said they'd land. YG JSON Image Downloader is the save half of the YG JSON Prompt Loader pair: it takes each generated image, files it under the output_path your JSON specified, and on the last image of the run packs the whole job into a ZIP that mirrors your file's folder structure exactly. If your JSON said images/devotional/001.jpg, that's where it goes - and that's where it'll be inside the archive.
How it works
It's a pure output node - no outputs, it just records. Each run it receives the generated images plus the output_path forwarded from the loader. The path is sanitized first (it strips leading slashes and rejects anything that would escape the job's output root, so a malicious or mangled output_path can't write outside ComfyUI/output/yg_json_output/<job_id>/), then the image is written there. Format follows the extension in output_path: .jpg/.jpeg are written as RGB JPEG at quality 95, everything else is saved via PIL as-is (PNG, WebP...). So the file type is a property of your JSON, which is a neat trick if a batch needs mixed formats.
The batch signal is is_last, just like the ZIP nodes: when the loader says the last entry is done, the downloader walks the whole job folder, builds <job_id>.zip, and tells the frontend a download button is ready. If a run gets interrupted, a "Create ZIP Now" fallback packages whatever's saved.
The inputs you wire
images- the generator's output.output_path- from the loader's matching output (it'sforceInput, so it must be wired).is_last- also from the loader; triggers the final ZIP.job_id- must match the loader'sjob_id. Same mismatch trap as every node in this family: nothing screams at you, the two just stop being the same job.
Optional current_index / total_count feed the progress UI only.
Installing it
It ships in comfyui_yg_nodes (MIT, "YG Custom Nodes" v1.0.4 by Mallikarjuna Rao Koliparthi), zero extra Python dependencies. ComfyUI Manager: search comfyui_yg_nodes. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/mallikarjunaraokoliparthi/comfyui_yg_nodes.git
Restart ComfyUI; it's under YG Custom Nodes.
Common issues
Same restart gotcha as the loader: state is in-memory per job_id, so a restart mid-batch means the loader restarts from entry zero and the downloader will happily re-save - and on the new last image, rebuild the ZIP. For long runs, prefer finishing in one session or changing job_id between restarts. Two output_path values pointing at the same filename will silently overwrite (last run wins). And don't forget the saved images are re-encodes, so any embedded workflow metadata from a prior SaveImage doesn't survive - these are batch outputs, not archival masters. If you're running a prompt list from JSON and want the results back in a tidy, structure-preserving ZIP at the end, this node closes the loop cleanly.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| output_path | STRING | — | |
| is_last | BOOLEAN | — | |
| job_id | STRING | my_json_job | Must match the job_id in YG JSON Prompt Loader. |
| current_indexopt | INT | 0 | — |
| total_countopt | INT | 1 | — |
Outputs (0)
No outputs