Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(canvas): restore masked-only generation output
Josh Corbett31352889a065
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex ae37be607d..28d91f57d9 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -2256,6 +2256,7 @@"invertBrushScroll": "Invert scroll for brush size","label": "Canvas settings","logDebugInfo": "Log debug info",+ "outputOnlyMaskedRegions": "Output only generated regions","ruleOfThirds": "Rule of thirds","sections": {"behavior": "Behavior",diff --git a/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.test.ts b/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.test.tsindex 04ae26fe13..12f197a401 100644--- a/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.test.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.test.ts@@ -109,6 +109,7 @@ const compile = (compositing?: Partial<CanvasCompositingSettings>;strength?: number;destination?: 'canvas' | 'gallery';+ outputOnlyMaskedRegions?: boolean;controlLayers?: readonly ControlLayerGraphInput[];regionalGuidance?: readonly RegionalGuidanceInput[];} = {}@@ -128,6 +129,7 @@ const compile = (mode,model,noiseMaskImageName: overrides.noiseMaskImageName ?? null,+ outputOnlyMaskedRegions: overrides.outputOnlyMaskedRegions ?? false,projectSettings: PROJECT_SETTINGS,settings: settingsFor(model, {...COMPONENT_OVERRIDES[model.base],@@ -462,6 +464,7 @@ describe('compileCanvasGraph', () => {destination: 'canvas',mode: 'txt2img',model: fluxModel,+ outputOnlyMaskedRegions: false,projectSettings: PROJECT_SETTINGS,settings: settingsFor(fluxModel),strength: 0.6,@@ -532,6 +535,34 @@ describe('compileCanvasGraph — inpaint per base', () => {expect(metaEdge?.destination.node_id).toBe('canvas_output');});+ it('outputs only the generated mask region with transparency when requested', () => {+ const { backendGraph } = compile(sd1Model, 'inpaint', { outputOnlyMaskedRegions: true });++ const output = backendGraph.nodes.canvas_output;+ expect(output?.type).toBe('apply_mask_to_image');+ expect(output?.invert_mask).toBe(true);+ expect(output?.is_intermediate).toBe(true);+ expect(backendGraph.nodes.canvas_l2i?.is_intermediate).toBe(true);+ expect(getEdge(backendGraph, 'canvas_output', 'image')?.source.node_id).toBe('canvas_l2i');+ expect(getEdge(backendGraph, 'canvas_output', 'mask')?.source.node_id).toBe('expand_mask');+ expect(output?.layer_base).toBeUndefined();++ const metadata = getNodeByType(backendGraph, 'core_metadata')!;+ const metaEdge = backendGraph.edges.find(+ (edge) => edge.source.node_id === metadata.id && edge.destination.field === 'metadata'+ );+ expect(metaEdge?.destination.node_id).toBe('canvas_output');+ });++ it('composites the generated mask region over the initial image when masked-only output is disabled', () => {+ const { backendGraph } = compile(sd1Model, 'inpaint', { outputOnlyMaskedRegions: false });++ expect(backendGraph.nodes.canvas_output).toMatchObject({+ layer_base: { image_name: 'canvas-composite.png' },+ type: 'invokeai_img_blend',+ });+ });+it('wires a UNet edge into create_gradient_mask only for SD-family models', () => {const sd = compile(sd1Model, 'inpaint').backendGraph;expect(getEdge(sd, 'create_gradient_mask', 'unet')).toBeDefined();diff --git a/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts b/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.tsindex 020c15bdda..5be2414e68 100644--- a/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts@@ -289,9 +289,9 @@ const addInfillNode = (/*** Shared inpaint/outpaint tail: gradient denoise mask → denoise, expand-with-fade,- * and the composite-back blend (`canvas_output`). `maskSource` supplies the- * grayscale mask feeding `create_gradient_mask`; `initialImageName` is the base- * to paste the decoded result back onto.+ * and the final `canvas_output`. The output either retains transparency outside+ * the generated region or composites back over the source image, depending on+ * `outputOnlyMaskedRegions`.*/const graftMaskTail = (graph: BackendGraphContract,@@ -304,14 +304,17 @@ const graftMaskTail = (initialImageName: string;compositing: CanvasCompositingSettings;destination: CompileCanvasGraphInput['destination'];+ outputOnlyMaskedRegions: boolean;/** Either a fixed mask image field or an edge-fed source node. */gradientMaskImage?: { image_name: string };gradientMaskEdge?: { node: BackendInvocationContract; field: string };}): void => {- const { compositing, denoise, destination, i2lType, initialImageName, settings, vaeSource } = args;+ const { compositing, denoise, destination, i2lType, initialImageName, outputOnlyMaskedRegions, settings, vaeSource } =+ args;- // Demote the base decode to an intermediate `canvas_l2i`; the blend becomes `canvas_output`.+ // Demote the base decode to an intermediate `canvas_l2i`; the final mask or+ // composite node claims `canvas_output`.const l2i = renameNode(graph, 'canvas_output', 'canvas_l2i');l2i.is_intermediate = true;@@ -344,20 +347,28 @@ const graftMaskTail = (});addEdge(graph, gradientMask, 'expanded_mask_area', expandMask, 'mask');- const blend = addNode(graph, {- id: 'canvas_output',- is_intermediate: destination === 'canvas',- layer_base: { image_name: initialImageName },- type: 'invokeai_img_blend',- use_cache: false,- });- addEdge(graph, l2i, 'image', blend, 'layer_upper');- addEdge(graph, expandMask, 'image', blend, 'mask');+ const output = outputOnlyMaskedRegions+ ? addNode(graph, {+ id: 'canvas_output',+ invert_mask: true,+ is_intermediate: destination === 'canvas',+ type: 'apply_mask_to_image',+ use_cache: false,+ })+ : addNode(graph, {+ id: 'canvas_output',+ is_intermediate: destination === 'canvas',+ layer_base: { image_name: initialImageName },+ type: 'invokeai_img_blend',+ use_cache: false,+ });+ addEdge(graph, l2i, 'image', output, outputOnlyMaskedRegions ? 'image' : 'layer_upper');+ addEdge(graph, expandMask, 'image', output, 'mask');// The base builder wired core_metadata → the decode's `metadata`; `renameNode`// followed it onto the (now intermediate) canvas_l2i. Re-point it to the final- // blend so the saved image carries generation metadata (invokeai_img_blend is- // WithMetadata). Board fields, when present, ride the same node.+ // output so the saved image carries generation metadata. Both possible output+ // nodes are WithMetadata; board fields, when present, ride the same node.const metadataEdge = graph.edges.find((edge) => edge.destination.node_id === 'canvas_l2i' && edge.destination.field === 'metadata');@@ -428,6 +439,7 @@ const graftInpaint = (i2lType,initialImageName,model,+ outputOnlyMaskedRegions: input.outputOnlyMaskedRegions,settings: input.settings,vaeSource,});@@ -492,6 +504,7 @@ const graftOutpaint = (i2lType,initialImageName,model,+ outputOnlyMaskedRegions: input.outputOnlyMaskedRegions,settings: input.settings,vaeSource,});diff --git a/invokeai/frontend/webv2/src/features/generation/core/canvas/types.ts b/invokeai/frontend/webv2/src/features/generation/core/canvas/types.tsindex 316acb2b94..59b07d83de 100644--- a/invokeai/frontend/webv2/src/features/generation/core/canvas/types.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/canvas/types.ts@@ -82,6 +82,8 @@ export interface CompileCanvasGraphInput {noiseMaskImageName?: string | null;/** Denoising strength in (0, 1]. Consulted for `img2img` / `inpaint` / `outpaint`. */strength: number;+ /** When true, preserve alpha outside the generated mask instead of compositing over the source image. */+ outputOnlyMaskedRegions: boolean;/** Infill / coherence / mask-blur knobs. Defaults applied by the reader. */compositing?: CanvasCompositingSettings;/**diff --git a/invokeai/frontend/webv2/src/workbench/invocation.test.ts b/invokeai/frontend/webv2/src/workbench/invocation.test.tsindex 2fba396b8c..97e270bc43 100644--- a/invokeai/frontend/webv2/src/workbench/invocation.test.ts+++ b/invokeai/frontend/webv2/src/workbench/invocation.test.ts@@ -103,8 +103,11 @@ const createGenerateValues = (...overrides,});-const getActiveProject = (values: GenerateWidgetValues) => {- const state = workbenchReducer(createInitialWorkbenchState(), { type: 'setGenerateSettings', values });+const getActiveProject = (values: GenerateWidgetValues, canvasValues?: Record<string, unknown>) => {+ let state = workbenchReducer(createInitialWorkbenchState(), { type: 'setGenerateSettings', values });+ if (canvasValues) {+ state = workbenchReducer(state, { type: 'patchWidgetValues', values: canvasValues, widgetId: 'canvas' });+ }const project = state.projects.find((candidate) => candidate.id === state.activeProjectId);expect(project).toBeDefined();@@ -364,7 +367,8 @@ describe('submitResolvedInvocation', () => {it('routes a canvas source through prepareCanvasInvocation and does not dispatch a resolved snapshot', () => {const project = getActiveProject(- createGenerateValues(animaModel, { qwen3EncoderModel: qwen3Encoder, vae: animaVae })+ createGenerateValues(animaModel, { qwen3EncoderModel: qwen3Encoder, vae: animaVae }),+ { outputOnlyMaskedRegions: false });const commands = createWorkbenchStore().commands;const submitResolved = vi.spyOn(commands.generation, 'submitResolved');@@ -379,6 +383,7 @@ describe('submitResolvedInvocation', () => {// The resolved destination rides through so a Canvas source can target the Gallery.expect(prepareCanvasInvocation.mock.calls[0]?.[0]).toMatchObject({destination: 'gallery',+ outputOnlyMaskedRegions: false,owner,projectId: project.id,});diff --git a/invokeai/frontend/webv2/src/workbench/invocationSubmit.ts b/invokeai/frontend/webv2/src/workbench/invocationSubmit.tsindex 0909319fa3..5e69848ba2 100644--- a/invokeai/frontend/webv2/src/workbench/invocationSubmit.ts+++ b/invokeai/frontend/webv2/src/workbench/invocationSubmit.ts@@ -28,6 +28,7 @@ import { isAccountScopeCurrent } from '@platform/state/accountLifecycle';import type { PrepareCanvasInvocationArgs } from './widgets/canvas/invoke/prepareCanvasInvocation';import type { WorkbenchCommands } from './workbenchStore';+import { readCanvasOutputOnlyMaskedRegions } from './widgets/canvas/canvasSettings';import { readCanvasCompositingSettings } from './widgets/canvas/invoke/canvasCompositing';import { readCanvasDenoisingStrength } from './widgets/canvas/invoke/canvasStrength';import { getProjectWidgetValues } from './widgetState';@@ -179,6 +180,7 @@ const dispatchResolvedInvocation = (formatControlLayerError,generateValues: getProjectWidgetValues(project, 'generate'),models,+ outputOnlyMaskedRegions: readCanvasOutputOnlyMaskedRegions(getProjectWidgetValues(project, 'canvas')),owner,positivePrompts,projectId: project.id,diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsxindex 0f387977fd..a80b26ce55 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx@@ -100,8 +100,8 @@ export const CanvasWidgetView = ({ runtime }: WidgetViewProps) => {return;}for (const setting of CANVAS_SETTINGS) {- // Only engine-backed settings feed a store; React-consumed ones (e.g.- // showProgressOnCanvas, read below) have no store and are skipped here.+ // Only engine-backed settings feed a store; settings consumed elsewhere+ // in the frontend have no store and are skipped here.if (setting.store) {engine.interaction.set(setting.store, settings[setting.key]);}diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasSettings.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasSettings.test.tsindex 11a1c9e8ea..c7a6b01447 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasSettings.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasSettings.test.ts@@ -5,6 +5,7 @@ import {CANVAS_CHECKERBOARD_KEY,CANVAS_CLIP_TO_BBOX_KEY,CANVAS_INVERT_BRUSH_SCROLL_KEY,+ CANVAS_OUTPUT_ONLY_MASKED_REGIONS_KEY,CANVAS_RULE_OF_THIRDS_KEY,CANVAS_SETTING_SECTIONS,CANVAS_SETTINGS,@@ -31,6 +32,8 @@ const DEFAULTS = {// Off by default, matching legacy — strokes are unclipped until asked.[CANVAS_CLIP_TO_BBOX_KEY]: false,[CANVAS_INVERT_BRUSH_SCROLL_KEY]: false,+ // Legacy default: keep the generation result transparent outside the mask.+ [CANVAS_OUTPUT_ONLY_MASKED_REGIONS_KEY]: true,[CANVAS_RULE_OF_THIRDS_KEY]: false,[CANVAS_SHOW_BBOX_KEY]: true,[CANVAS_SHOW_GRID_KEY]: false,@@ -50,6 +53,7 @@ describe('canvasSettings persistence mapping', () => {[CANVAS_CHECKERBOARD_KEY]: false,[CANVAS_CLIP_TO_BBOX_KEY]: true,[CANVAS_INVERT_BRUSH_SCROLL_KEY]: true,+ [CANVAS_OUTPUT_ONLY_MASKED_REGIONS_KEY]: false,[CANVAS_RULE_OF_THIRDS_KEY]: true,[CANVAS_SHOW_BBOX_KEY]: false,[CANVAS_SHOW_GRID_KEY]: true,@@ -61,6 +65,7 @@ describe('canvasSettings persistence mapping', () => {[CANVAS_CHECKERBOARD_KEY]: false,[CANVAS_CLIP_TO_BBOX_KEY]: true,[CANVAS_INVERT_BRUSH_SCROLL_KEY]: true,+ [CANVAS_OUTPUT_ONLY_MASKED_REGIONS_KEY]: false,[CANVAS_RULE_OF_THIRDS_KEY]: true,[CANVAS_SHOW_BBOX_KEY]: false,[CANVAS_SHOW_GRID_KEY]: true,@@ -84,11 +89,12 @@ describe('canvasSettings persistence mapping', () => {}});- it('gives every engine-backed store a distinct store id (React-consumed settings have none)', () => {+ it('gives every engine-backed store a distinct store id (other frontend-consumed settings have none)', () => {const stores = CANVAS_SETTINGS.map((s) => s.store).filter((s): s is NonNullable<typeof s> => s !== undefined);expect(new Set(stores).size).toBe(stores.length);- // showProgressOnCanvas is consumed React-side and intentionally has no store.+ // These are consumed outside the engine and intentionally have no store.expect(settingByKey(CANVAS_SHOW_PROGRESS_KEY).store).toBeUndefined();+ expect(settingByKey(CANVAS_OUTPUT_ONLY_MASKED_REGIONS_KEY).store).toBeUndefined();});});diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasSettings.ts b/invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasSettings.tsindex a7bf3377ad..6eefba3ebf 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasSettings.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasSettings.ts@@ -12,8 +12,9 @@* A setting either drives an engine boolean store (`store` set — React resolves* the persisted value and feeds it down; see the settings-feed effect in* `CanvasWidgetView`, the engine reads only its stores and never React) OR is- * consumed directly React-side (`store` absent — e.g. `showProgressOnCanvas`,- * which gates the progress-preview feed in the widget shell). The feed is strictly+ * consumed elsewhere in the frontend (`store` absent — e.g. `showProgressOnCanvas`+ * in the widget shell or `outputOnlyMaskedRegions` during invocation submission).+ * The feed is strictly* one-directional: settings → engine, never the reverse.** The list is data-driven: adding a boolean setting is one entry here plus its@@ -21,7 +22,7 @@* no React, no engine imports — unit-testable in node.*/-/** Which engine boolean store a setting feeds (settings whose `store` is absent are React-consumed). */+/** Which engine boolean store a setting feeds (settings without one are consumed elsewhere in the frontend). */export type CanvasSettingStore =| 'checkerboard'| 'showGrid'@@ -45,12 +46,22 @@ export const CANVAS_RULE_OF_THIRDS_KEY = 'ruleOfThirds';export const CANVAS_SNAP_TO_GRID_KEY = 'snapToGrid';export const CANVAS_CLIP_TO_BBOX_KEY = 'clipToBbox';export const CANVAS_SHOW_PROGRESS_KEY = 'showProgressOnCanvas';+export const CANVAS_OUTPUT_ONLY_MASKED_REGIONS_KEY = 'outputOnlyMaskedRegions';++const OUTPUT_ONLY_MASKED_REGIONS_SETTING: CanvasBooleanSetting = {+ // Legacy parity: generation results keep alpha outside the expanded mask+ // unless the user explicitly asks to composite them over the source image.+ defaultValue: true,+ key: CANVAS_OUTPUT_ONLY_MASKED_REGIONS_KEY,+ labelKey: 'widgets.canvas.settings.outputOnlyMaskedRegions',+ section: 'behavior',+};/** A single boolean canvas setting: its persisted key, default, label, section, and (optional) engine store. */export interface CanvasBooleanSetting {/** The persisted key inside the canvas widget's `state.values`. */key: string;- /** The engine store this value drives; absent when the setting is consumed React-side. */+ /** The engine store this value drives; absent when another frontend path consumes the setting. */store?: CanvasSettingStore;/** Default value applied when the key is unset. */defaultValue: boolean;@@ -84,6 +95,7 @@ export const CANVAS_SETTINGS: readonly CanvasBooleanSetting[] = [section: 'behavior',store: 'clipToBbox',},+ OUTPUT_ONLY_MASKED_REGIONS_SETTING,// ── Display ───────────────────────────────────────────────────────────────{defaultValue: true,@@ -154,6 +166,10 @@ export const readCanvasBooleanSetting = (return typeof raw === 'boolean' ? raw : setting.defaultValue;};+/** Reads whether generation output should retain transparency outside the mask. */+export const readCanvasOutputOnlyMaskedRegions = (values: Record<string, unknown> | undefined): boolean =>+ readCanvasBooleanSetting(values, OUTPUT_ONLY_MASKED_REGIONS_SETTING);+/** Resolves every canvas setting from persisted values into a key→boolean map. */export const resolveCanvasSettings = (values: Record<string, unknown> | undefined): ResolvedCanvasSettings => {const resolved: ResolvedCanvasSettings = {};diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.test.tsindex ea33791a54..7e24f61b74 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.test.ts@@ -144,6 +144,7 @@ interface HarnessOptions {projectId?: string;dispatch?: ReturnType<typeof vi.fn<(action: WorkbenchAction) => void>>;models?: RunCanvasInvocationDeps['models'];+ outputOnlyMaskedRegions?: boolean;}const makeHarness = (options: HarnessOptions = {}): Harness => {@@ -266,6 +267,7 @@ const makeHarness = (options: HarnessOptions = {}): Harness => {generateValues: generateValuesFor(model),inFlight: options.inFlight ?? new Set<string>(),models: options.models,+ outputOnlyMaskedRegions: options.outputOnlyMaskedRegions ?? true,projectId: options.projectId ?? 'project-1',projectSettings: { useCpuNoise: true },signal: new AbortController().signal,@@ -1044,7 +1046,7 @@ describe('runCanvasInvocation — inpaint / outpaint dispatch', () => {expect(submitted[0]?.graph.label).toBe('SD 1.5 inpaint');const nodes = submitted[0]!.graph.backendGraph!.nodes;expect(nodes.create_gradient_mask?.type).toBe('create_gradient_mask');- expect(nodes.canvas_output?.type).toBe('invokeai_img_blend');+ expect(nodes.canvas_output?.type).toBe('apply_mask_to_image');// The gradient mask consumes the uploaded grayscale mask (base upload is composite-1).expect((nodes.create_gradient_mask?.mask as { image_name?: string } | undefined)?.image_name).toBeDefined();expect(harness.notices()).toHaveLength(0);@@ -1064,9 +1066,22 @@ describe('runCanvasInvocation — inpaint / outpaint dispatch', () => {const nodes = submitted[0]!.graph.backendGraph!.nodes;expect(nodes.infill?.type).toBe('infill_lama');expect(nodes.image_alpha_to_mask?.type).toBe('tomask');- expect(nodes.canvas_output?.type).toBe('invokeai_img_blend');+ expect(nodes.canvas_output?.type).toBe('apply_mask_to_image');expect(harness.notices()).toHaveLength(0);});++ it('composites the generated region over the source when masked-only output is disabled', async () => {+ const doc = docWithLayers([rasterLayer('base'), inpaintMaskLayer('mask')]);+ const harness = makeHarness({ document: doc, outputOnlyMaskedRegions: false });++ await runCanvasInvocation(harness.deps);++ const nodes = harness.submittedGraphs()[0]!.graph.backendGraph!.nodes;+ expect(nodes.canvas_output).toMatchObject({+ layer_base: expect.objectContaining({ image_name: expect.any(String) }),+ type: 'invokeai_img_blend',+ });+ });});// Task 39, finding 1: a regional reference image is only usable once an image isdiff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts b/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.tsindex c51b099bb7..ca044d868a 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts@@ -121,6 +121,8 @@ export interface RunCanvasInvocationDeps {strength: number;/** Persisted compositing settings (infill / coherence / mask blur), defaulted + clamped. */compositing: CanvasCompositingSettings;+ /** Preserve transparency outside the generated mask instead of compositing over the source image. */+ outputOnlyMaskedRegions: boolean;commands: Pick<WorkbenchCommands, 'generation' | 'notifications'>;/** Localizes a control-layer rejection; defaults to the English validation sentence. */formatControlLayerError?: (code: ControlValidationReason, layerName: string) => string;@@ -389,6 +391,7 @@ export const runCanvasInvocation = async (deps: RunCanvasInvocationDeps): Promismode,model,noiseMaskImageName: composites.noiseMaskImageName,+ outputOnlyMaskedRegions: deps.outputOnlyMaskedRegions,projectSettings: deps.projectSettings,randDevice: deps.randDevice,regionalGuidance: regions.toGraphInputs(composites.regionalMaskImages),@@ -457,6 +460,8 @@ export interface PrepareCanvasInvocationArgs {* (`readCanvasCompositingSettings`). Falls back to legacy defaults when omitted.*/compositing?: CanvasCompositingSettings;+ /** Preserve transparency outside the generated mask. Defaults to legacy behavior (enabled). */+ outputOnlyMaskedRegions?: boolean;commands: Pick<WorkbenchCommands, 'generation' | 'notifications'>;/** Localizes a control-layer rejection; defaults to the English validation sentence. */formatControlLayerError?: (code: ControlValidationReason, layerName: string) => string;@@ -491,6 +496,7 @@ export const prepareCanvasInvocation = async (args: PrepareCanvasInvocationArgs)inFlight: inFlightProjects,inFlightKey: `${owner.epoch}:${args.projectId}`,models: args.models,+ outputOnlyMaskedRegions: args.outputOnlyMaskedRegions ?? true,projectId: args.projectId,projectSettings: args.projectSettings,randDevice: resolveRandDeviceMetadata(args.projectSettings.useCpuNoise, getGenerationDevicesSnapshot().options),