Nodes/BrainDead Nodes/BD Parts Export
ComfyUI Node

BD Parts Export

From parts bundle to PSD — BD Parts Export ships the whole package

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
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

The parts pipeline ends the same way every asset pipeline does: files on disk. BD Parts Export takes a finished PARTS_BUNDLE and writes out everything you could want - per-tag RGBA sprites, depth maps, the original SAM3 visibility masks, a flat composite, a layered PSD, a manifest, and the clean base image. It's the "deliverable" node of the whole character-parts workflow, and it's the one that makes the pile of crops usable in Photoshop, Unreal, or a game engine.

It's an output node, so ComfyUI always runs it. The primary inputs are parts and a filename (base name). Then a wall of toggles, all defaulting on, deciding what lands where:

  • save_pngs - one RGBA PNG per tag.
  • save_depth - {tag}_depth.png per part, only if the bundle carries per-part depth (wire depth_image into BD Parts Builder upstream).
  • save_masks - {tag}_mask.png, the original SAM3 visibility mask (white = was visible, black = was occluded). This is the "drop it in Photoshop to re-apply the original visibility cut on a redrawn layer" file.
  • save_masked_pngs - {tag}_masked.png: Qwen-rebuilt content with the original visibility mask baked into alpha. Ready to composite without opening Photoshop.
  • save_composite - {filename}_composite.png + its alpha.
  • save_psd - a layered PSD, one layer per tag at its original position, z-sorted back-to-front by depth_median, raw-compressed for Photoshop compatibility.
  • save_psb - the same as a Photoshop Big-document, for canvases past PSD's 30k px / 2GB limits.
  • save_base - the wired base_image (e.g. the underpaint bare background) as a standalone PNG.
  • save_manifest - a JSON describing everything: frame size, base PNG, and a parts[] list with tag, sprite, mask, depth, bbox, and depth_order. One file an importer can read instead of globbing.

composite_size (default 0 = use frame size) drives the composite PNG and PSD canvas - set 4096 for 4K production output.

Naming: legacy vs context mode

Without a BD Save Context, it uses the legacy folder layout ({name_prefix}_{filename}_NNN/{tag}.png). Wire context_id (or leave empty to auto-pick the single registered context) and naming follows the SaveContext template, with suffix = tag per-part, _composite for the composite, empty for the PSD. The category_table widget (with its bundled default mapping tags → %slug%/%region%) turns free-form Qwen-VL tags into filename-safe paths like Letti/clothing/upper_shirt_0001.png. There's a huge pre-filled table with fuzzy ~pattern substring matching - you can leave it alone and it still handles "blue left sneaker" → left_sneaker. Outputs include parts (passthrough), output_dir, summary, the composite images, and a parts image batch.

Install & the honest notes

In ComfyUI-BrainDead: Manager search "BrainDead", or clone + pip install -r requirements.txt, restart. V3-API pack, keep ComfyUI updated.

Two things commonly surprise people. First, this node is front-heavy - it's genuinely worth reading the tooltips once because the mask vs masked vs depth distinction is the whole point of the pack's pipeline and easy to conflate. Second, PSD support has real teeth here (raw compression, PSB for big canvases), but it also means a big bundle with lots of parts and a 4096 canvas can take a while and write a lot of files - that's expected, not a hang. If your PSD won't open in older Photoshop, you've probably outgrown PSD's 2GB limit and need save_psb instead.

Category🧠BrainDead/Segmentation

Inputs (19)

NameTypeDefaultDescription
partsPARTS_BUNDLE
filenameSTRINGpartsLegacy mode: base name for the output folder. Context mode: feeds %name% / %filename% in the template.
name_prefixoptSTRINGLegacy mode: prepended to filename, supports subdirs (e.g. 'Characters/Letti'). Context mode: feeds %name_prefix% in the template.
auto_incrementoptBOOLEANtrueLegacy mode only: append _001/_002/... to folder name.
context_idoptSTRINGMatch a BD_SaveContext id. Empty + exactly one registered = auto-pick. Per-tag files use suffix=tag; composite uses suffix='_composite'.
save_pngsoptBOOLEANtrueWrite one RGBA PNG per tag.
save_depthoptBOOLEANtrueAlso write {tag}_depth.png grayscale per part. Requires bundle to carry per-part depth (wire depth_image into BD_PartsBuilder).
save_masksoptBOOLEANtrueAlso 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_pngsoptBOOLEANtrueAlso 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_compositeoptBOOLEANtrueAlso write {filename}_composite.png (RGBA) and {filename}_composite_alpha.png (mask).
composite_sizeoptINT00–8192Max 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_psdoptBOOLEANtrueAlso 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_psboptBOOLEANfalseAlso 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_baseoptBOOLEANtrueWrite {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_manifestoptBOOLEANtrueWrite {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_imageoptIMAGEOptional 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_imageoptIMAGEOptional 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_tableoptSTRING# 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_pathoptSTRINGPath 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)

NameTypeDescription
partsPARTS_BUNDLE
output_dirSTRING
summarySTRING
composite_imageIMAGE
composite_image_maskedIMAGE
parts_image_batchIMAGE