Badge Studio Background GPT V1
It can only touch pixels that aren't the badge
- badge_image
- foreground_mask
- studio_candidate
- background_edit_mask
- call_status
Product shots of a badge live or die on the background. Pure white, a soft contact shadow, one controlled softbox - that's the whole look, and getting it from a generative model usually means handing the model your finished badge and praying it doesn't "improve" the artwork while it's in there.
Badge Studio Background GPT V1 is the narrow version of that job. It takes your badge image and a foreground mask, inverts the mask, dilates it a little for safety, and gives GPT Image 2 exactly one job: fill the outside of the badge with a white studio environment. The badge's pixels are not part of the editable region at all, so they can't be redrawn.
The mechanism, and why the mask shape matters
foreground_mask is the badge. The node thresholds it at 0.5 and then dilates it with protection_px (default 2, max 64) using a max-pool - that dilation is the guard band, and it exists because GPT's masked edits blur slightly at the boundary. Two pixels of protection stops an edit from nibbling a highlight off the badge's bevel.
The editable mask is the complement of that, and it's what comes out as background_edit_mask. Note the polarity, because it's the opposite of most masked-edit nodes in ComfyUI: white here means background, and the status JSON says so explicitly (white_is_background_edit).
If enabled is on and the mask contains anything at all, the node expands a native OpenAIGPTImageNodeV2 child at 1024×1024 with your badge as Image 1 and that inverted mask, plus a prompt built around a single non-negotiable sentence: the final background must read as white - not grey, not beige, not a gradient, not environmental scenery. Your studio_prompt gets appended as a STUDIO DIRECTION: block after all the prohibitions.
That "not grey" clause is doing real work. Ask any image model for a soft studio background and there's a strong pull toward moody grey gradients and vignetting, which then makes your product page look dirty next to everyone else's. The node also asks for reserved space for a subtle contact shadow, which is what sells the object as sitting on a surface rather than floating.
Hard limits worth knowing: exactly one image per run. It validates badge_image has batch size 1 and the mask matches the dimensions, and it errors rather than broadcasting.
Outputs
studio_candidate- the GPT result: your badge over a generated white environment. Note this is not the final image; the flat-artwork colour hasn't been restored yet.background_edit_mask- the dilated inverse mask actually used, as a MASK. Keep it; the colour-lock node wants a foreground mask, and this is the complementary information.call_status- JSON: whether a GPT node was used, whether that means a billable request on a cache miss,protection_px,quality,reroll_revision, and areason(active_background_edit,disabled,empty_background_mask).
Chain it straight into Badge Studio Color Lock V1, which reinserts the exact foreground and pulls colour back toward your flat artwork. Splitting the two is the whole point: the generative step is allowed to invent a background and is structurally forbidden from inventing a badge.
Cost and settings
quality defaults to high here - unlike the semantic channel node, which defaults to medium. Backgrounds are big smooth gradients and low quality shows as banding, so high is arguably the right default, but it's also the most expensive one and you're billed in Comfy account credits. reroll_revision is the seed; change it to get a different background without touching your inputs, and leave it alone when you just want the cached result back.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/TeutonicMepheles/ComfyUI-DAELab-Custom-Nodes-Library.git
Restart ComfyUI and refresh the browser tab. This is a V3 node on comfy_api.latest, so keep ComfyUI reasonably current; if the log says No module named 'comfy_api', update ComfyUI core rather than pip-installing anything by that name. You'll also need a signed-in Comfy account for the partner-node credits.
ComfyUI Manager: search "ComfyUI-DAELab-Custom-Nodes-Library" and install the pack, then restart. Clone the full repo if you're doing it by hand - __init__.py at the root is what registers these IDs.
Gotchas
Mask polarity is the classic mistake. Wiring a foreground mask into a node that expects the inverse gives you a white badge on a preserved-photo background, which looks broken but is at least obviously wrong. If you're unsure, preview background_edit_mask: the badge should be black in it.
A too-tight mask is the subtle one. If your foreground mask hugs the silhouette exactly with no margin, the edit will start right at the edge and you'll see a bright rim where the generated white meets the badge. That's what protection_px is for - 2 is a sane default, 4–6 if your mask came from a soft-threshold background removal.
And don't expect this to fix a bad foreground. If the badge's own mask is wrong, you'll get a beautifully lit white studio around a mangled cutout. Get the foreground right first - that's the pack's mask-extraction branch, not this node.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| badge_image | IMAGE | — | |
| foreground_mask | MASK | — | |
| enabled | BOOLEAN | true | — |
| studio_prompt | STRING | Clean premium product photography on a pure white seamless studio background, soft contact shadow, controlled softbox lighting. | — |
| protection_px | INT | 20–64 | — |
| quality | COMBO | high | 3 options: low, medium, high |
| reroll_revision | INT | 00–2147483647 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| studio_candidate | IMAGE | — |
| background_edit_mask | MASK | — |
| call_status | STRING | — |