Nodes/ComfyUI_Swwan/IO Save Image Format (Swwan) · 旧版兼容
ComfyUI Node

IO Save Image Format (Swwan) · 旧版兼容

A saver tuned for the tail end of a queue

By aining2022·Created 11 months ago·Updated a day ago· 35
IO Save Image Format (Swwan) · 旧版兼容
  • image
  • out_path
◄file_format▾►
◄output_path./output►
◄filename_midtmp►
◄number_prefixfalse►
◄number_digits5►
◄quality88►
◄png_compress_level1►
◄optimizetrue►
◄webp_losslessfalse►
◄webp_method2►

Stock ComfyUI's Save Image is fine until the encode is the bottleneck. On a Replicate-style job, or any queue where you're billed per second of execution, the PNG compression step at the end can eat more wall-clock than the diffusion itself. IO Save Image Format is the answer to that specific annoyance: a saver stripped down to the parameters that actually affect encode time and file size, with defaults tuned for fast export.

The pack README says it plainly: this node cut the metadata and workflow-embedding logic out of format saving, keeping only quality, png_compress_level, optimize, webp_lossless, and webp_method. Nothing else that could slow the tail end of the job survives.

What it does

Required inputs: image, file_format (jpg/png/webp/tif/bmp), output_path (default ./output), and filename_mid (the middle of the output filename). Optional tuning: number_prefix (put the counter before or after the name), number_digits (how many digits the counter pads to), and the encode knobs.

The defaults are where the "fast export" intent lives:

  • file_format - the node doesn't default it in the schema, but the README's recommended starting point is jpg, quality=88
  • png_compress_level=1 - PNG level 9 saves a few percent more but can be an order of magnitude slower; for batch saves, level 1 is the sensible middle
  • optimize=true - with a built-in fallback
  • webp_method=2 - WebP's method slider (0–6) is a time/quality trade; low numbers are fast, and the README suggests 0–2 for Replicate

There's a thoughtful detail in the fallback: if a Pillow encoder errors out with optimize=true (some do), the node automatically retries without it instead of killing the whole batch. That's the kind of resilience you want in an unattended queue.

Output: out_path, a STRING list of the absolute paths it wrote - so you can chain the saver's output into a node that needs to know where files landed.

Installing it

It ships in ComfyUI_Swwan:

cd ComfyUI/custom_nodes
git clone https://github.com/aining2022/ComfyUI_Swwan
pip install -r ComfyUI_Swwan/requirements.txt

Or install the pack via ComfyUI Manager, search "ComfyUI_Swwan".

Where people get burned

The counter logic scans the output directory for the highest existing number matching your filename_mid and increments from there, so a mixed-up directory with unrelated numbered files can start you at an unexpected offset - clean the folder if the numbering looks off. And remember this is a bare saver: it writes no workflow metadata into PNGs, so a workflow you save this way won't reconstruct when dragged back into ComfyUI. That's a feature for speed, but a gotcha if you're used to "save PNG, share image, everyone gets the workflow." For reproducible shares you'd want the standard Save Image (with metadata) instead.

CategorySwwan/Legacy

Inputs (11)

NameTypeDefaultDescription
imageIMAGE—
file_formatCOMBO5 options: jpg, png, webp, tif, bmp
output_pathSTRING./output—
filename_midSTRINGtmp—
number_prefixoptBOOLEANfalse—
number_digitsoptINT51–10编号位数,如设置为3则为001格式
qualityoptINT881–100JPEG/WebP 质量。数值越高体积通常越大、保存通常越慢。
png_compress_leveloptINT10–9PNG 压缩等级。Replicate 场景建议保持较低数值以减少保存耗时。
optimizeoptBOOLEANtrue启用 Pillow optimize。主要影响 JPEG/TIFF。若编码器报错,节点会自动回退到不使用 optimize。
webp_losslessoptBOOLEANfalse启用无损 WebP。通常会更慢且文件更大。
webp_methodoptINT20–6WebP 编码方法。越高通常压得更小,但更慢。Replicate 场景建议使用 0-2。

Outputs (1)

NameTypeDescription
out_pathSTRING—