Nodes/ComfyUI-QG-Tools/Export Image
ComfyUI Node

Export Image

QG_ExportImage

By live1617·Created about a month ago·Updated 2 days ago· 4
Export Image
  • images
    ◄formatJPEG►
    ◄quality90►
    ◄subsampling4:4:4►
    ◄alpha_modeon-white►
    ◄filename_prefixComfyUI►
    ◄save_path►

    ComfyUI's core SaveImage writes one format: PNG. Lossless, correct, and enormous - a 2K render lands around 4–6 MB, and if you're generating a hundred drafts you feel that on disk before you feel it anywhere else. So people go looking for a JPEG save node and find one that hard-codes quality 90, or one that ships a separate "compress" node you're supposed to put upstream.

    That second pattern doesn't work, and the author of QG_ExportImage says so bluntly in the node's own source comments: a compression node outputs an IMAGE tensor, the save node then re-encodes it, and the final quality is decided by the save node regardless of what you set upstream. You turn the knob and nothing changes.

    So the quality knob lives at the encoder here, which is the only place it can live.

    What you actually get

    The node takes an image batch and writes one file per frame, in JPEG, PNG or WEBP:

    • format - the container. JPEG is smallest and lossy, PNG is lossless and bulky, WEBP sits between and keeps alpha.
    • quality (1–100, default 90) - used by JPEG and WEBP. PNG ignores it entirely because PNG is lossless; setting it does nothing, which the tooltip states outright.
    • subsampling - JPEG only. 4:4:4 keeps all colour detail, 4:2:2 saves roughly 15% and softens red and orange edges, 4:2:0 saves more and only shows when you look at half size.
    • alpha_mode - what to do when the input has a transparency channel: composite onto white, composite onto black, or keep the alpha. Keeping it requires PNG or WEBP; pick JPEG and it falls back to white.
    • filename_prefix and, optionally, save_path.

    The alpha handling is the part I'd call genuinely useful. Flattening onto white or black instead of letting a transparent input become a half-transparent mess is exactly the kind of thing a naive PIL round-trip gets wrong, leaving dark fringes around cut-out subjects.

    File naming, and why it's not a gimmick

    Naming follows ComfyUI's own convention: ComfyUI_00001_.jpg, a five-digit counter that reuses folder_paths.get_save_image_path - the same function the native node uses - so exports and native saves can share one output folder without overwriting each other's numbering. That's a small detail that shows the author thought about mixed workflows instead of assuming his node is the only writer.

    The prefix also takes templates: %date:yyyyMMdd%, %time:HHmmss%, %INDEX% (position in batch), %BATCH% (batch size), plus the native set %width% %height% %year% %month% %day% %hour% %minute% %second% %batch_num%. So portraits/%date:yyyyMMdd%/shot_%INDEX% is a legal prefix and actually does what it looks like.

    save_path is the optional extra: empty means ComfyUI's output/, a relative path means a subfolder under output (which cannot escape it - the code checks commonpath), and an absolute path or ~ path or UNC share works too. It refuses to write into Windows/System32/Program Files/AppData, refuses drive roots, and refuses a bare D:.

    The thing nobody tells you about exporting

    Here's the trade-off that should decide whether you use this node, and it isn't in the README.

    In this ecosystem the PNG is the project file. ComfyUI writes the whole node graph and the API prompt into PNG text chunks, which is why dragging an output image back onto the canvas reconstructs the workflow. Re-encode that image - to JPEG, to WEBP, through a host that recompresses - and the graph is gone. JPEG and WEBP have no PNG text chunks; best case you get a flat parameter string in EXIF, and that isn't a loadable workflow.

    And there's a second layer specific to this node: as of v0.9.4 the encoder writes pixels and nothing else - no pnginfo, no EXIF. So even its PNG output has no embedded workflow. That's fine and arguably deliberate for an "export" node, but it means:

    Use QG_ExportImage for deliverables. Keep the native SaveImage PNG as the master. The lossless file with the graph inside it is your archive copy; the JPEG is what you upload. This node is a publishing step, not a backup step.

    Installing

    Part of ComfyUI-QG-tools. No dependencies at all - this node uses only torch, numpy, PIL and folder_paths, all of which ship with ComfyUI, and the pack's requirements.txt is intentionally comment-only.

    cd ComfyUI/custom_nodes
    git clone https://github.com/live1617/ComfyUI-QG-tools
    

    Restart ComfyUI fully. Node lives under QG-tools/Image; search save, export, jpg, webp, quality or 导出.

    Troubleshooting

    "It never wrote anything." It should - the node overrides IS_CHANGED to return the current time precisely so the cache can't skip a save. If nothing appeared, check where you pointed save_path; a custom (non-output) directory means ComfyUI serves a downscaled thumbnail into the node preview instead of the full image, because the real file is outside /view's reach. The file is there, the preview just isn't the full-size one.

    Path refusals are deliberate, not bugs. System folders, drive roots and a bare D: all raise a clear error. So does a relative save_path that tries to climb out of output/ with ...

    Quality 100 on JPEG doesn't mean lossless. It means "least lossy lossy". If someone's comparing your export to their PNG and finding banding in gradients, that's chroma subsampling plus quantisation; 4:4:4 and quality 92+ gets you close, PNG gets you exact.

    CategoryQG-tools/Image

    Inputs (7)

    NameTypeDefaultDescription
    imagesIMAGEThe images to export. Every frame in a batch is written out as its own file.
    formatCOMBOJPEGJPEG is lossy and the smallest; PNG is lossless and bulky; WEBP sits between the two and keeps transparency.
    qualityINT901–100Encoding quality, used by JPEG and WEBP only, since PNG is lossless and ignores it. 90 is the usual visually lossless setting; drop to 85 to save real space, and below that the loss starts to show.
    subsamplingCOMBO4:4:4Chroma subsampling, JPEG only. 4:4:4 keeps every bit of colour detail; 4:2:2 saves around 15% and softens red and orange edges; 4:2:0 saves a little more and only shows when you view at half size.
    alpha_modeCOMBOon-whiteWhat to do with a transparency channel on the input: composite onto white or black and save an opaque image, or keep the transparency as it is. Only PNG and WEBP support it, and choosing JPEG falls back to white.
    filename_prefixSTRINGComfyUIFilename prefix -- the name only, no directory. Naming matches ComfyUI's own Save Image node exactly: the output looks like ComfyUI_00001_.png, a five digit counter that skips numbers already taken in the folder. Variables: %date:yyyyMMdd% for the date, %time:HHmmss% for the time, %INDEX% for the position in the batch, %BATCH% for the batch size; the native set %width% %height% %year% %month% %day% %hour% %minute% %second% %batch_num% works too.
    save_pathoptSTRINGLeave empty to write into ComfyUI's output folder. You can also give a subfolder name such as auto/2026, a full absolute path (D:\pics\today), a network share (\\NAS\share\pics), a path holding environment variables (%USERPROFILE%\Desktop\pics), or one starting with a tilde (~\Desktop\pics). System folders, drive roots and a bare drive letter such as D: are all refused.

    Outputs (0)

    No outputs