ComfyUI Node
BD Parts Export
Write a PARTS_BUNDLE to disk. Per-tag RGBA PNGs, optional per-tag depth PNGs (when bundle has 'depth' from BD_PartsBuilder + depth_image), optional flat composite PNG, and optional layered PSD (raw-compressed for Photoshop compatibility). Wire `context_id` from BD_SaveContext for template-based naming (suffix = tag for per-part, '_composite' for composite, '' for psd). Without context, uses legacy folder layout: {name_prefix}_{filename}_NNN/{tag}.png
BD Parts Export
- parts
- base_image
- background_image
- parts
- output_dir
- summary
- composite_image
- composite_image_masked
- parts_image_batch
◄filenameparts►
◄name_prefix►
◄auto_incrementtrue►
◄context_id►
◄save_pngstrue►
◄save_depthtrue►
◄save_maskstrue►
◄save_masked_pngstrue►
◄save_compositetrue►
◄composite_size0►
◄save_psdtrue►
◄save_psbfalse►
◄save_basetrue►
◄save_manifesttrue►
◄category_table# BD Parts Category Table — Character (Sapiens2 taxonomy)
# Format: tag = slug:region
# tag — exact part tag from BD_PartsBuilder (must match case)
# slug — short filename-safe name exposed as %slug% in BD_SaveContext templates
# region — body region for folder/path grouping exposed as %region% in templates
#
# Lines starting with # are ignored. Blank lines are ignored.
# tag = slug (no colon) sets slug only, region stays empty.
# Empty table (all lines blank/comments) = passthrough: tag is used as slug, region is "".
#
# Fuzzy / substring matching (Qwen-VL free-form tags):
# Prefix a line with ~ to do a case-insensitive substring match instead of exact.
# Among all matching ~patterns, the LONGEST wins (most-specific first).
# Put more-specific patterns before less-specific ones in this file for readability;
# the parser sorts by length automatically so ordering doesn't matter for correctness.
# ~sneaker matches "blue left sneaker", "right white sneaker", etc.
# ~left shoe matches "left red shoe" (wins over ~shoe for left-side tags)
#
# Example template using these vars:
# %character%/%region%/%slug%%suffix%
# → Letti/head/face_0001.png, Letti/clothing/upper_shirt_0001.png
# ── Head ──────────────────────────────────────────────────────────────────────
Face_Neck = face_neck:head
Hair = hair:head
# ── Body ──────────────────────────────────────────────────────────────────────
Torso = torso:body
# ── Clothing ──────────────────────────────────────────────────────────────────
Upper_Clothing = upper_clothing:clothing
Lower_Clothing = lower_clothing:clothing
Apparel = apparel:clothing
# ── Arms ──────────────────────────────────────────────────────────────────────
Left_Upper_Arm = left_upper_arm:arms
Left_Lower_Arm = left_lower_arm:arms
Left_Hand = left_hand:arms
Right_Upper_Arm = right_upper_arm:arms
Right_Lower_Arm = right_lower_arm:arms
Right_Hand = right_hand:arms
# ── Legs ──────────────────────────────────────────────────────────────────────
Left_Upper_Leg = left_upper_leg:legs
Left_Lower_Leg = left_lower_leg:legs
Left_Foot = left_foot:legs
Right_Upper_Leg = right_upper_leg:legs
Right_Lower_Leg = right_lower_leg:legs
Right_Foot = right_foot:legs
# ── Footwear ──────────────────────────────────────────────────────────────────
Left_Shoe = left_shoe:footwear
Left_Sock = left_sock:footwear
Right_Shoe = right_shoe:footwear
Right_Sock = right_sock:footwear
# ── Face detail ───────────────────────────────────────────────────────────────
Lower_Lip = lower_lip:face
Upper_Lip = upper_lip:face
Lower_Teeth = lower_teeth:face
Upper_Teeth = upper_teeth:face
Tongue = tongue:face
# ── Accessories ───────────────────────────────────────────────────────────────
Eyeglass = eyeglass:accessories
# ── Qwen-VL fuzzy matches (~pattern = case-insensitive substring) ─────────────
# Body parts — head/face (side-specific first, then generic)
~eye brows = eyebrows:head
~left eye = left_eye:head
~right eye = right_eye:head
~eye brow = eyebrow:head
~facial hair = facial_hair:head
~left ear = left_ear:head
~right ear = right_ear:head
~eye = eye:head
~ear = ear:head
~nose = nose:head
~mouth = mouth:head
~lips = lips:head
~lip = lip:head
~beard = beard:head
~mustache = mustache:head
~face = face:head
~hair = hair:head
~neck = neck:head
~head = head:head
# Body parts — torso/upper body
~left shoulder = left_shoulder:body
~right shoulder = right_shoulder:body
~shoulder = shoulder:body
~chest = chest:body
~torso = torso:body
~upper body = upper_body:body
~abdomen = abdomen:body
~belly = belly:body
~waist = waist:body
~back = back:body
~spine = spine:body
# Body parts — arms/hands (side-specific first)
~left upper arm = left_upper_arm:arms
~right upper arm = right_upper_arm:arms
~left lower arm = left_lower_arm:arms
~right lower arm = right_lower_arm:arms
~left arm = left_arm:arms
~right arm = right_arm:arms
~left hand = left_hand:arms
~right hand = right_hand:arms
~left forearm = left_forearm:arms
~right forearm = right_forearm:arms
~left wrist = left_wrist:arms
~right wrist = right_wrist:arms
~left elbow = left_elbow:arms
~right elbow = right_elbow:arms
~arm = arm:arms
~hand = hand:arms
~forearm = forearm:arms
~wrist = wrist:arms
~elbow = elbow:arms
~fingers = fingers:arms
~finger = finger:arms
~palm = palm:arms
# Body parts — legs/feet (side-specific first)
~left upper leg = left_upper_leg:legs
~right upper leg = right_upper_leg:legs
~left lower leg = left_lower_leg:legs
~right lower leg = right_lower_leg:legs
~left leg = left_leg:legs
~right leg = right_leg:legs
~left foot = left_foot:legs
~right foot = right_foot:legs
~left thigh = left_thigh:legs
~right thigh = right_thigh:legs
~left calf = left_calf:legs
~right calf = right_calf:legs
~left knee = left_knee:legs
~right knee = right_knee:legs
~left ankle = left_ankle:legs
~right ankle = right_ankle:legs
~leg = leg:legs
~foot = foot:legs
~thigh = thigh:legs
~calf = calf:legs
~knee = knee:legs
~ankle = ankle:legs
~toe = toe:legs
~toes = toes:legs
# Clothing — skin/body coverings
~skin = skin:body
~body = body:body
~nude = nude:body
~underwear = underwear:clothing
~underpants = underwear:clothing
~bra = bra:clothing
~panties = panties:clothing
~boxer = boxers:clothing
~apron = apron:clothing
# Footwear — side-specific first (longer = wins over bare "shoe"/"sneaker")
~left sneaker = left_sneaker:footwear
~right sneaker = right_sneaker:footwear
~left shoe = left_shoe:footwear
~right shoe = right_shoe:footwear
~left boot = left_boot:footwear
~right boot = right_boot:footwear
~left sock = left_sock:footwear
~right sock = right_sock:footwear
~sneaker = sneaker:footwear
~shoe = shoe:footwear
~boot = boot:footwear
~sock = sock:footwear
~heel = heel:footwear
~sandal = sandal:footwear
~slipper = slipper:footwear
~kicks = sneaker:footwear
# Clothing — upper body
~jacket = jacket:clothing
~coat = coat:clothing
~hoodie = hoodie:clothing
~sweater = sweater:clothing
~sweatshirt = sweatshirt:clothing
~shirt = shirt:clothing
~blouse = blouse:clothing
~top = top:clothing
~dress = dress:clothing
~skirt = skirt:clothing
~vest = vest:clothing
~suit = suit:clothing
~blazer = blazer:clothing
~cardigan = cardigan:clothing
~tank = tank_top:clothing
# Clothing — lower body (more specific before less specific)
~denim jean = jeans:clothing
~jean = jeans:clothing
~denim = jeans:clothing
~trouser = trousers:clothing
~pant = pants:clothing
~short = shorts:clothing
~legging = leggings:clothing
~skirt = skirt:clothing
# Lower body — extra
~overall = overalls:clothing
~swimsuit = swimsuit:clothing
~bikini = bikini:clothing
~armor = armor:clothing
# Accessories
~sunglasses = sunglasses:accessories
~eyeglass = glasses:accessories
~goggles = goggles:accessories
~glasses = glasses:accessories
~watch = watch:accessories
~bracelet = bracelet:accessories
~necklace = necklace:accessories
~chain = chain:accessories
~earring = earring:accessories
~ring = ring:accessories
~headphone = headphones:accessories
~hat = hat:accessories
~cap = cap:accessories
~helmet = helmet:accessories
~beanie = beanie:accessories
~headband = headband:accessories
~scarf = scarf:accessories
~left glove = left_glove:accessories
~right glove = right_glove:accessories
~glove = glove:accessories
~face mask = face_mask:accessories
~bag = bag:accessories
~backpack = backpack:accessories
~purse = purse:accessories
~belt = belt:accessories
~tie = tie:accessories
~bow tie = bow_tie:accessories
►
◄category_table_path►
Category🧠BrainDead/Segmentation
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| parts | PARTS_BUNDLE | — | |
| filename | STRING | parts | Legacy mode: base name for the output folder. Context mode: feeds %name% / %filename% in the template. |
| name_prefixopt | STRING | Legacy mode: prepended to filename, supports subdirs (e.g. 'Characters/Letti'). Context mode: feeds %name_prefix% in the template. | |
| auto_incrementopt | BOOLEAN | true | Legacy mode only: append _001/_002/... to folder name. |
| context_idopt | STRING | Match a BD_SaveContext id. Empty + exactly one registered = auto-pick. Per-tag files use suffix=tag; composite uses suffix='_composite'. | |
| save_pngsopt | BOOLEAN | true | Write one RGBA PNG per tag. |
| save_depthopt | BOOLEAN | true | Also write {tag}_depth.png grayscale per part. Requires bundle to carry per-part depth (wire depth_image into BD_PartsBuilder). |
| save_masksopt | BOOLEAN | true | Also write {tag}_mask.png — single-channel grayscale of the ORIGINAL SAM3 mask (the visible region in the source, before Qwen redraw), resized to match the rebuilt part dims. Drop into Photoshop to re-apply the original visibility cut on a redrawn layer. White = was visible, Black = was occluded. If the bundle was never edited (no PartsBatchEdit step), falls back to the part's current alpha channel. |
| save_masked_pngsopt | BOOLEAN | true | Also write {tag}_masked.png — RGBA PNG where RGB = the Qwen-rebuilt content and alpha = the ORIGINAL SAM3 visibility mask. Ready to composite back onto the body without opening Photoshop — the crop is already baked in. Example: hair rebuilt by Qwen, cut to original strand silhouette, ready to paste onto body. Falls back to the part's current alpha if no original mask exists (un-edited bundle). |
| save_compositeopt | BOOLEAN | true | Also write {filename}_composite.png (RGBA) and {filename}_composite_alpha.png (mask). |
| composite_sizeopt | INT | 00–8192 | Max side length of composite PNG AND PSD canvas. Scales xyxy and layer dims to match. 0 = use frame_size as-is. Set to e.g. 4096 for 4K production output. |
| save_psdopt | BOOLEAN | true | Also write {filename}.psd — single layered file with one layer per tag at its xyxy position. Layer order: back-to-front by depth_median. RAW compression (Photoshop-compatible). |
| save_psbopt | BOOLEAN | false | Also write {filename}.psb — the Photoshop Big-document format (same layers as the PSD, version 2). Use when the target engine expects .psb, or for canvases beyond PSD's 30,000 px / 2 GB limits. Independent of save_psd — enable either or both. |
| save_baseopt | BOOLEAN | true | Write {filename}_base.png — the wired base_image (e.g. the underpaint bare background) as a standalone RGB PNG at its native resolution. This is the clean scene background (layer 0); the composite has sprites baked on, so this is saved separately. |
| save_manifestopt | BOOLEAN | true | Write {filename}_manifest.json — one authoritative file describing the export: scene, base png, frame [w,h], and a parts[] list with {tag, sprite, mask, depth, bbox_px [x,y,w,h], depth_median, depth_order}. depth_order 0 = furthest back (matches PSD stack). Lets an importer read one file instead of globbing + deriving. |
| base_imageopt | IMAGE | Optional base IMAGE (e.g. nude mannequin) painted UNDER all parts. Becomes the SECOND-FROM-BOTTOM PSD layer (full canvas, visible, above background_image if any) and the base of composite_image. Resized to canvas dim if needed. | |
| background_imageopt | IMAGE | Optional background IMAGE painted UNDER base_image. Becomes the BOTTOM layer of the PSD (full canvas, visible). NOT included in composite_image outputs by default — keeps the composite clean. PSD layer order back-to-front: background_image → base_image → parts (z-sorted) → mask layers. | |
| category_tableopt | STRING | # BD Parts Category Table — Character (Sapiens2 taxonomy) # Format: tag = slug:region # tag — exact part tag from BD_PartsBuilder (must match case) # slug — short filename-safe name exposed as %slug% in BD_SaveContext templates # region — body region for folder/path grouping exposed as %region% in templates # # Lines starting with # are ignored. Blank lines are ignored. # tag = slug (no colon) sets slug only, region stays empty. # Empty table (all lines blank/comments) = passthrough: tag is used as slug, region is "". # # Fuzzy / substring matching (Qwen-VL free-form tags): # Prefix a line with ~ to do a case-insensitive substring match instead of exact. # Among all matching ~patterns, the LONGEST wins (most-specific first). # Put more-specific patterns before less-specific ones in this file for readability; # the parser sorts by length automatically so ordering doesn't matter for correctness. # ~sneaker matches "blue left sneaker", "right white sneaker", etc. # ~left shoe matches "left red shoe" (wins over ~shoe for left-side tags) # # Example template using these vars: # %character%/%region%/%slug%%suffix% # → Letti/head/face_0001.png, Letti/clothing/upper_shirt_0001.png # ── Head ────────────────────────────────────────────────────────────────────── Face_Neck = face_neck:head Hair = hair:head # ── Body ────────────────────────────────────────────────────────────────────── Torso = torso:body # ── Clothing ────────────────────────────────────────────────────────────────── Upper_Clothing = upper_clothing:clothing Lower_Clothing = lower_clothing:clothing Apparel = apparel:clothing # ── Arms ────────────────────────────────────────────────────────────────────── Left_Upper_Arm = left_upper_arm:arms Left_Lower_Arm = left_lower_arm:arms Left_Hand = left_hand:arms Right_Upper_Arm = right_upper_arm:arms Right_Lower_Arm = right_lower_arm:arms Right_Hand = right_hand:arms # ── Legs ────────────────────────────────────────────────────────────────────── Left_Upper_Leg = left_upper_leg:legs Left_Lower_Leg = left_lower_leg:legs Left_Foot = left_foot:legs Right_Upper_Leg = right_upper_leg:legs Right_Lower_Leg = right_lower_leg:legs Right_Foot = right_foot:legs # ── Footwear ────────────────────────────────────────────────────────────────── Left_Shoe = left_shoe:footwear Left_Sock = left_sock:footwear Right_Shoe = right_shoe:footwear Right_Sock = right_sock:footwear # ── Face detail ─────────────────────────────────────────────────────────────── Lower_Lip = lower_lip:face Upper_Lip = upper_lip:face Lower_Teeth = lower_teeth:face Upper_Teeth = upper_teeth:face Tongue = tongue:face # ── Accessories ─────────────────────────────────────────────────────────────── Eyeglass = eyeglass:accessories # ── Qwen-VL fuzzy matches (~pattern = case-insensitive substring) ───────────── # Body parts — head/face (side-specific first, then generic) ~eye brows = eyebrows:head ~left eye = left_eye:head ~right eye = right_eye:head ~eye brow = eyebrow:head ~facial hair = facial_hair:head ~left ear = left_ear:head ~right ear = right_ear:head ~eye = eye:head ~ear = ear:head ~nose = nose:head ~mouth = mouth:head ~lips = lips:head ~lip = lip:head ~beard = beard:head ~mustache = mustache:head ~face = face:head ~hair = hair:head ~neck = neck:head ~head = head:head # Body parts — torso/upper body ~left shoulder = left_shoulder:body ~right shoulder = right_shoulder:body ~shoulder = shoulder:body ~chest = chest:body ~torso = torso:body ~upper body = upper_body:body ~abdomen = abdomen:body ~belly = belly:body ~waist = waist:body ~back = back:body ~spine = spine:body # Body parts — arms/hands (side-specific first) ~left upper arm = left_upper_arm:arms ~right upper arm = right_upper_arm:arms ~left lower arm = left_lower_arm:arms ~right lower arm = right_lower_arm:arms ~left arm = left_arm:arms ~right arm = right_arm:arms ~left hand = left_hand:arms ~right hand = right_hand:arms ~left forearm = left_forearm:arms ~right forearm = right_forearm:arms ~left wrist = left_wrist:arms ~right wrist = right_wrist:arms ~left elbow = left_elbow:arms ~right elbow = right_elbow:arms ~arm = arm:arms ~hand = hand:arms ~forearm = forearm:arms ~wrist = wrist:arms ~elbow = elbow:arms ~fingers = fingers:arms ~finger = finger:arms ~palm = palm:arms # Body parts — legs/feet (side-specific first) ~left upper leg = left_upper_leg:legs ~right upper leg = right_upper_leg:legs ~left lower leg = left_lower_leg:legs ~right lower leg = right_lower_leg:legs ~left leg = left_leg:legs ~right leg = right_leg:legs ~left foot = left_foot:legs ~right foot = right_foot:legs ~left thigh = left_thigh:legs ~right thigh = right_thigh:legs ~left calf = left_calf:legs ~right calf = right_calf:legs ~left knee = left_knee:legs ~right knee = right_knee:legs ~left ankle = left_ankle:legs ~right ankle = right_ankle:legs ~leg = leg:legs ~foot = foot:legs ~thigh = thigh:legs ~calf = calf:legs ~knee = knee:legs ~ankle = ankle:legs ~toe = toe:legs ~toes = toes:legs # Clothing — skin/body coverings ~skin = skin:body ~body = body:body ~nude = nude:body ~underwear = underwear:clothing ~underpants = underwear:clothing ~bra = bra:clothing ~panties = panties:clothing ~boxer = boxers:clothing ~apron = apron:clothing # Footwear — side-specific first (longer = wins over bare "shoe"/"sneaker") ~left sneaker = left_sneaker:footwear ~right sneaker = right_sneaker:footwear ~left shoe = left_shoe:footwear ~right shoe = right_shoe:footwear ~left boot = left_boot:footwear ~right boot = right_boot:footwear ~left sock = left_sock:footwear ~right sock = right_sock:footwear ~sneaker = sneaker:footwear ~shoe = shoe:footwear ~boot = boot:footwear ~sock = sock:footwear ~heel = heel:footwear ~sandal = sandal:footwear ~slipper = slipper:footwear ~kicks = sneaker:footwear # Clothing — upper body ~jacket = jacket:clothing ~coat = coat:clothing ~hoodie = hoodie:clothing ~sweater = sweater:clothing ~sweatshirt = sweatshirt:clothing ~shirt = shirt:clothing ~blouse = blouse:clothing ~top = top:clothing ~dress = dress:clothing ~skirt = skirt:clothing ~vest = vest:clothing ~suit = suit:clothing ~blazer = blazer:clothing ~cardigan = cardigan:clothing ~tank = tank_top:clothing # Clothing — lower body (more specific before less specific) ~denim jean = jeans:clothing ~jean = jeans:clothing ~denim = jeans:clothing ~trouser = trousers:clothing ~pant = pants:clothing ~short = shorts:clothing ~legging = leggings:clothing ~skirt = skirt:clothing # Lower body — extra ~overall = overalls:clothing ~swimsuit = swimsuit:clothing ~bikini = bikini:clothing ~armor = armor:clothing # Accessories ~sunglasses = sunglasses:accessories ~eyeglass = glasses:accessories ~goggles = goggles:accessories ~glasses = glasses:accessories ~watch = watch:accessories ~bracelet = bracelet:accessories ~necklace = necklace:accessories ~chain = chain:accessories ~earring = earring:accessories ~ring = ring:accessories ~headphone = headphones:accessories ~hat = hat:accessories ~cap = cap:accessories ~helmet = helmet:accessories ~beanie = beanie:accessories ~headband = headband:accessories ~scarf = scarf:accessories ~left glove = left_glove:accessories ~right glove = right_glove:accessories ~glove = glove:accessories ~face mask = face_mask:accessories ~bag = bag:accessories ~backpack = backpack:accessories ~purse = purse:accessories ~belt = belt:accessories ~tie = tie:accessories ~bow tie = bow_tie:accessories | Maps part tags → (slug, region) for template-based path naming. Format per line: tag = slug:region %slug% — short filename-safe name (e.g. 'face_neck') %region% — body region for folder grouping (e.g. 'head') Lines starting with # are comments. Leave empty to use the bundled default character category table. Only active when a BD_SaveContext is wired (context mode). Ignored in legacy (no-context) mode. Default loaded from: /tmp/ComfyUI/custom_nodes/ComfyUI-BrainDead/config/parts_categories_character.txt |
| category_table_pathopt | STRING | Path to an external category table .txt file. When set and the file exists, its contents REPLACE the category_table widget text above — useful for a team-shared centralized mapping. Leave empty to use the widget text above. Default bundled file: /tmp/ComfyUI/custom_nodes/ComfyUI-BrainDead/config/parts_categories_character.txt |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| parts | PARTS_BUNDLE | — |
| output_dir | STRING | — |
| summary | STRING | — |
| composite_image | IMAGE | — |
| composite_image_masked | IMAGE | — |
| parts_image_batch | IMAGE | — |