Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Layers: Remove background offers FeyNoBg's fine-hair cut-out on your GPU and Bria's guided cut-out with a what-to-keep box, and a mask goes on to ProRes or EXR export

Claude5fffa9ce6618
diff --git a/src/app/(studio)/layers/[id]/page.tsx b/src/app/(studio)/layers/[id]/page.tsx
index 1efd6296..85dbe700 100644
--- a/src/app/(studio)/layers/[id]/page.tsx
+++ b/src/app/(studio)/layers/[id]/page.tsx
@@ -25,6 +25,7 @@ function toolModels(): Record<string, LayerModelInfo> {
? { pricing: { unit: m.pricing.unit, usd: m.pricing.usd, ...(m.pricing.note ? { note: m.pricing.note } : {}), ...(m.pricing.promo ? { promo: m.pricing.promo } : {}) } }
: {}),
providers: [...new Set(m.routes.map((r) => r.provider))],
+ ...(m.options.guided ? { guided: true } : {}),
};
}
return out;
diff --git a/src/components/layers/tools.tsx b/src/components/layers/tools.tsx
index 85f2d1b9..8db5da5b 100644
--- a/src/components/layers/tools.tsx
+++ b/src/components/layers/tools.tsx
@@ -701,6 +701,23 @@ function SimpleTool({
);
}
+/** Remove background: the subject on transparency; a guided model (Bria's) also takes words on what to keep or drop. */
+function RemoveBgTool() {
+ const picker = useToolModel("bg-remove");
+ const [guide, setGuide] = useState("");
+ const guided = !!picker.model?.guided;
+ return (
+ <SimpleTool tool="bg-remove" verb="Remove background" failedTitle="Failed to load image. Please try again." picker={picker} prompt={guided ? guide.trim() || undefined : undefined}>
+ <HowItWorks>Remove background finds the main subject of your image and cuts everything else away, giving you the subject on a transparent background.</HowItWorks>
+ {guided && (
+ <Field label="What to keep or drop (optional)" htmlFor="cutout-guide">
+ <Input id="cutout-guide" value={guide} onChange={(e) => setGuide(e.target.value)} maxLength={300} placeholder="e.g. “keep the shadow” or “without the hand”" className="h-9" />
+ </Field>
+ )}
+ </SimpleTool>
+ );
+}
+
function RelightTool() {
const { selected } = useEditor();
const [light, setLight] = useState(RELIGHT_LIGHTS[0][0]);
@@ -1354,11 +1371,7 @@ export function ToolRail() {
{tool === "decompose" && <DecomposeTool />}
{/* Its rows belong to one scope: picking another layer (or the whole image) starts afresh. */}
{tool === "edit-text" && <EditTextTool key={selected?.id ?? "whole"} />}
- {tool === "remove-bg" && (
- <SimpleTool tool="bg-remove" verb="Remove background" failedTitle="Failed to load image. Please try again.">
- <HowItWorks>Remove background finds the main subject of your image and cuts everything else away, giving you the subject on a transparent background.</HowItWorks>
- </SimpleTool>
- )}
+ {tool === "remove-bg" && <RemoveBgTool />}
{tool === "regional" && <RegionalTool />}
{/* Its painted area belongs to one layer (or the whole image): picking another starts afresh. */}
{tool === "inpaint" && <InpaintTool key={selected?.id ?? "whole"} />}
diff --git a/src/components/studio/result-actions.tsx b/src/components/studio/result-actions.tsx
index 758ed278..495b122f 100644
--- a/src/components/studio/result-actions.tsx
+++ b/src/components/studio/result-actions.tsx
@@ -19,6 +19,7 @@ import {
ImagePlus,
Layers2,
Palette,
+ Film,
LayoutDashboard,
Mic2,
MicOff,
@@ -122,6 +123,7 @@ export const ACTION_ICONS: Record<OutputActionId, LucideIcon> = {
"delete-upload": Trash2,
restore: ArchiveRestore,
"restore-video": Palette,
+ "export-pro": Film,
"delete-forever": Trash2,
};
diff --git a/src/lib/av/keying.ts b/src/lib/av/keying.ts
index f96359fc..2a44ada7 100644
--- a/src/lib/av/keying.ts
+++ b/src/lib/av/keying.ts
@@ -22,9 +22,9 @@ export function keyFormatValues(format: VideoFormat | undefined, output: MatteOu
/**
* Whether a Remove background or Green screen result can go to Export (ProRes 4444, EXR) as it is. The export reads a
- * WebM's colour but not its transparency, so only the black-and-white mask (or a clip with no alpha) keeps everything there;
- * a cut-out keeps its alpha only when the key writes ProRes 4444 or EXR itself.
+ * WebM's colour but not its transparency, so only the black-and-white mask and the clean foreground (no alpha) keep
+ * everything there; a cut-out keeps its alpha only when the matte writes ProRes 4444 or EXR itself.
*/
export function exportsCleanly(op: string | undefined, params: Pick<GenParams, "matteOutput"> | undefined): boolean {
- return op === "bg-remove-video" && params?.matteOutput === "matte";
+ return op === "bg-remove-video" && (params?.matteOutput === "matte" || params?.matteOutput === "foreground");
}
diff --git a/src/lib/layers.ts b/src/lib/layers.ts
index a1888562..a80a99d8 100644
--- a/src/lib/layers.ts
+++ b/src/lib/layers.ts
@@ -239,7 +239,8 @@ export const TOOL_MODELS: Record<LayerTool, { cloud: string[]; open: string[] }>
// reads it (fal lists $0 per compute second, real cost unverified: the catalog's $0.001 is a placeholder).
"text-detect": { cloud: ["ideogram-3-text-layers", "florence-2-ocr"], open: ["oss-ocr-lines"] },
"text-edit": { cloud: ["nano-banana-pro", "seedream-5-pro"], open: ["oss-qwen-image-21", "oss-qwen-image-21-turbo", "oss-krea2-edit"] },
- "bg-remove": { cloud: ["birefnet-cloud", "ideogram-remove-bg"], open: ["oss-rmbg"] },
+ // Bria's guided cut-out takes optional words on what to keep or drop; FeyNoBg keeps fine hair (nm10-keying).
+ "bg-remove": { cloud: ["birefnet-cloud", "ideogram-remove-bg", "bria-guided-cutout"], open: ["oss-rmbg", "oss-matte-feynobg"] },
regional: { cloud: ["seedream-5-pro", "nano-banana-pro"], open: ["oss-qwen-image-21", "oss-krea2-edit", "oss-fibo2-edit-turbo"] },
// SeedVR2 restores detail as it enlarges; 4x ESRGAN is the quick choice.
upscale: { cloud: ["topaz-image", "seedvr-image", "recraft-crisp"], open: ["oss-seedvr2-image", "oss-upscale-image"] },
@@ -377,6 +378,8 @@ export interface LayerModelInfo {
pricing?: { unit: string; usd: number; note?: string; promo?: Pricing["promo"] };
/** Providers its routes run on (demo detection: none of them connected). */
providers: string[];
+ /** It takes words on what to keep or drop (Bria's guided cut-out): Remove background shows a box for them. */
+ guided?: boolean;
}
/** Cuts the background back out after an edit model repaints a transparent layer. */
diff --git a/src/lib/output-actions.ts b/src/lib/output-actions.ts
index eece3a23..89d17b0c 100644
--- a/src/lib/output-actions.ts
+++ b/src/lib/output-actions.ts
@@ -14,6 +14,7 @@ import { decodeMoss, LAYOUT_PARAM, readLayout, type LayoutDraft } from "./layout
import { REMOVE_DIALOGUE_FEATURE } from "./av/remove-dialogue";
import { canRerender, regenerateFamily, regenerateHref, rerenderLabel } from "./catalog/regenerate";
import { CLEAN_FEATURE } from "./av/clean-voice";
+import { exportsCleanly } from "./av/keying";
export type OutputActionId =
| "animate"
@@ -58,6 +59,7 @@ export type OutputActionId =
| "delete-upload"
| "restore"
| "restore-video"
+ | "export-pro"
| "delete-forever";
export interface OutputAction {
@@ -140,6 +142,9 @@ export function outputActions(g: Generation, index: number, ctx: ActionContext =
link("upscale", "Upscale", `/upscale/video?video=${q(o.url)}`);
// Old, faded or black-and-white footage (Fuobe Restore): Video tools → Restore & colourise with the clip in.
link("restore-video", "Restore & colourise", `/video-tools/restore?video=${q(o.url)}`);
+ // A mask or clean foreground from Remove background or Green screen: on to ProRes 4444 or EXR for the edit (Export runs on
+ // your GPU). A cut-out isn't offered: Export would drop its transparency (src/lib/av/keying.ts).
+ if (ctx.engineMode !== "cloud" && exportsCleanly(g.op, g.request?.params)) link("export-pro", "Export as ProRes or EXR", `/upscale/export?video=${q(o.url)}&format=prores_4444`);
link("add-sound", "Add sound", `/audio/video?video=${q(o.url)}`);
link("split-soundtrack", "Split soundtrack", `/audio/split?video=${q(o.url)}`);
link("remove-dialogue", "Remove dialogue", `/video-tools/remove-dialogue?video=${q(o.url)}`);
diff --git a/src/server/layers.ts b/src/server/layers.ts
index 1d34fdb4..4ae68112 100644
--- a/src/server/layers.ts
+++ b/src/server/layers.ts
@@ -295,7 +295,8 @@ export function jobSteps(input: LayerJobInput, opts: { batchTitle?: string } = {
}
case "bg-remove": {
const model = toolModel(tool, engine, input.modelId);
- add("cut", base(model, { op: "bg-remove", inputs: { images: [needImage()] }, params: aspectFor(model) }));
+ // Bria's guided cut-out reads what to keep or drop ("keep the shadow"); the others take no words.
+ add("cut", base(model, { op: "bg-remove", ...(model.options.guided && prompt ? { prompt } : {}), inputs: { images: [needImage()] }, params: aspectFor(model) }));
break;
}
case "regional": {