Nodes/BrainDead Nodes/BD Parts Compose
ComfyUI Node

BD Parts Compose

Put the parts back together — BD Parts Compose

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
BD Parts Compose
  • parts
  • image
  • alpha
output_size0
triggertrue

The parts pipeline tears a character into separate crops so each one can be edited, rebuilt, or cleaned in isolation. Eventually you want the character back as a single image, with everything stacked where it started. BD Parts Compose is that reverse pass: it takes a PARTS_BUNDLE and reassembles it into a flat image, each part placed at its original scaled position, composited back-to-front.

The ordering detail is what makes it work. Parts are sorted by their depth_median - the per-part depth captured when BD Parts Builder was given a depth_image - so closer objects paint over farther ones the way the scene actually was. Without that depth, "which part is on top" would be undefined and you'd get an arm disappearing behind a torso. Standard alpha compositing does the blending: every part's RGBA mask drives the merge, so the crops composite cleanly regardless of their individual sizes.

The inputs

Just one required: parts (the PARTS_BUNDLE). Two optional knobs:

  • output_size (default 0) - max side length of the output canvas. 0 uses the frame size as-is. If you upscaled per-part 3× during edit, set this to match (e.g. 3072) so the reassembled image is at the new resolution.
  • trigger (default true) - if false, returns a blank canvas. This is the one that looks weird in isolation and makes sense in a loop: wire is_last from an iterator and set trigger to gate the composite until the final pass, so intermediate iterations don't each produce a half-composed image.

Outputs are image (RGBA) and alpha (the composite alpha as a MASK).

Where it sits

This is the lighter sibling of the export path. BD Parts Export also produces a composite (plus per-tag PNGs, depth, masks, a PSD, and a manifest) - use Export when you're writing files to disk for a real deliverable. Use Compose when you want the reassembled image in the graph - to preview it, pass it to another node, or feed it back into a pipeline without touching disk. If you have a BD Parts Underpaint base_image in the graph, you'll typically composite parts over that clean surface here (or via Export's base_image input) rather than on the original frame.

Install

Part of ComfyUI-BrainDead: Manager search "BrainDead", or clone + pip install -r requirements.txt, restart. Under 🧠BrainDead/Segmentation, V3-API pack, keep ComfyUI current.

The thing to remember: Compose is only as good as the depth data behind it. If parts were built without a depth_image, there's no depth_median, and the z-order falls back to bundle order - which may or may not be right. Feed BD Parts Builder a depth image (BD Lotus2 Predict's raw_linear) and the compose step just works. And when you're iterating, remember output_size is 0 by default - if the composited result comes out at the original frame resolution after you upscaled everything, that's not a bug, that's the default you forgot to change.

Category🧠BrainDead/Segmentation

Inputs (3)

NameTypeDefaultDescription
partsPARTS_BUNDLE
output_sizeoptINT00–8192Max side length of output canvas. 0 = use frame_size as-is. Set to e.g. 3072 if you upscaled per-part 3x.
triggeroptBOOLEANtrueIf false, returns blank canvas — useful when piping is_last from an iterator to delay composite until the final pass.

Outputs (2)

NameTypeDescription
imageIMAGE
alphaMASK