ComfyUI Node

BD Save File

Save any data type to output folder. Supports IMAGE, MASK, AUDIO, LATENT, STRING, TRIMESH. Optionally use a save context (from BD_SaveContext) for template-based paths.

By BizaNator·Created 7 months ago·Updated 16 days ago· 14
BD Save File
  • data
  • alpha_mask
  • data
  • file_path
  • status
filenamesaved_file
skip_if_existstrue
name_prefix
extension
context_id
suffix
custom_vars
save_alpha_separatelyfalse
invert_alphafalse
Category🧠BrainDead/Cache

Inputs (11)

NameTypeDefaultDescription
data*
filenameSTRINGsaved_fileWith context: overrides %name% / %filename% in template if set (non-'saved_file'). Without context: legacy filename.
skip_if_existsBOOLEANtrue
name_prefixoptSTRINGWith context: exposed as %name_prefix% in template. Without context: legacy prefix prepended to filename.
extensionoptSTRINGOverride auto-detected extension.
context_idoptSTRINGIf set AND a BD_SaveContext with this id is registered: path is resolved from the context's template + this node's suffix/filename/name_prefix. If empty AND exactly ONE context is registered, that one is auto-used. If empty AND zero or multiple contexts: legacy filename-based behavior.
suffixoptSTRINGPer-save suffix appended after filename (e.g. '_albedo', '_shoes', '_head'). Wire from BD_ForEachRun.label or Iterator.tag for per-iteration filenames. With context: also exposed as %suffix% in the template. Without context: appended literally to filename — caller controls separator (convention: leading underscore).
custom_varsoptSTRINGPer-save extra variables, one per line as key=value. Layered ON TOP of the context's custom_vars (this node's keys override context for matching names). Examples: subfolder=textures materials=metal pass=normal These become %subfolder%, %materials%, %pass% in the template. Empty values resolve cleanly (// → /). Undefined vars stay as %var% literals so you spot typos.
save_alpha_separatelyoptBOOLEANfalseAlso write the alpha channel as a standalone greyscale PNG alongside the main file, named with the same suffix + '_alpha'. Source of the alpha pixels: • alpha_mask wired → uses the mask (after invert_alpha) • no mask wired, image has 4 channels (RGBA) → extracts the embedded A channel • no mask wired, image is RGB (3ch) → no alpha to extract; this output is skipped NOTE: the _alpha.png is a RAW greyscale representation — white pixel = opaque area, black pixel = transparent area. It is NOT a composited preview; open the main RGBA PNG in a viewer that supports transparency to see the actual cut-out.
alpha_maskoptMASKBake this mask into the saved file's alpha channel before writing. Convention: WHITE (1.0) = OPAQUE, BLACK (0.0) = TRANSPARENT. Face mask (white face, black background) → face is opaque, background is cut out. Background mask (white background, black face) → use invert_alpha=True. If you already have an RGBA image (4-channel), you do NOT need to wire alpha_mask — the embedded alpha is preserved automatically when saving. The upstream image tensor is NOT modified — transparency is baked only in the saved file. Accepts batched masks (B, H, W); single (H,W) or (1,H,W) applies to all frames.
invert_alphaoptBOOLEANfalseFlip the mask polarity before baking as alpha. Use when your mask has white=background / black=subject and you want the subject opaque.

Outputs (3)

NameTypeDescription
data*
file_pathSTRING
statusSTRING