Nodes/Amazon Bedrock nodes for ComfyUI/Amazon Bedrock - Nova Canvas Background Prompt Replace
ComfyUI Node

Amazon Bedrock - Nova Canvas Background Prompt Replace

Swap a background by describing it, no mask painting

By aws-samples·Created 2 years ago·Updated about a year ago· 30
Amazon Bedrock - Nova Canvas Background Prompt Replace
  • image
  • IMAGE
prompt
mask_prompt
num_images1
cfg_scale8.0
seed0

You have a product shot, a portrait, a dog in a park - and you want the subject kept exactly as-is while the whole world behind them changes. Traditionally that's mask painting, inpainting, and compositing. This node skips the mask entirely: you describe what to keep, describe what the new background should be, and Nova Canvas does the rest over an API call.

How it works

Under the hood it uses Nova Canvas's OUTPAINTING task. You feed an image, a prompt describing the new background, and a mask_prompt that describes the subject to preserve - the model infers the mask from your words instead of you drawing one. outPaintingMode is hardcoded to PRECISE, which means Nova Canvas is instructed to change as little as possible and regenerate only what it must.

The KB's inpainting essay maps the landscape here neatly: masked inpainting's one unique gift is bit-identical untouched pixels, and this node gets you most of that without ever touching a mask tool - at the cost of trusting the model's text-based mask inference. It's also why mask_prompt is the highest-leverage input: the more specific you are ("a red coffee mug on a wooden table", not "the mug"), the better the inferred mask matches reality.

The inputs that matter

  • image - your starting photo.
  • prompt - what the new background should be. "a misty mountain lake at dawn" beats "nice background".
  • mask_prompt - what stays. Get this precise; it's the entire quality lever.
  • num_images (1–5), cfg_scale (default 8), seed - the usual dials.

Note there's no resolution input. The output size tracks your input image, which is the right call for a background swap - you don't want the model deciding your aspect ratio.

Output is an IMAGE tensor, ready for a Save Image node or the next step of the pipeline.

Installing it

The whole Bedrock pack, once:

cd ComfyUI/custom_nodes
git clone https://github.com/aws-samples/comfyui-llm-node-for-amazon-bedrock.git
pip install -r comfyui-llm-node-for-amazon-bedrock/requirements.txt

Restart ComfyUI (or ComfyUI Manager → search "Amazon Bedrock"). Dependencies: boto3, requests, retry.

Then the AWS prerequisites, which apply to every node in this pack: enable Nova Canvas model access in the us-east-1 region (this node hardcodes it) in the Bedrock console, and have credentials configured via aws configure or an IAM role. The README's SageMaker CloudFormation path sets all this up for you if you'd rather not fiddle.

Where people get burned

  • The mask is inferred, not guaranteed. A busy subject that's hard to describe in one sentence will blur the line between foreground and background. If the swap chews into your subject, tighten mask_prompt, don't reach for more cfg.
  • Content filters apply. Nova Canvas moderation blocks prompts it flags, and the node surfaces that as an error rather than a bad image.
  • Billing. Every image is a billable Nova Canvas call, and quality is hardcoded to the premium tier in the pack's generation config. Keep num_images at 1 while you dial in the mask prompt.
  • It's not a real matte. PRECISE mode keeps changes minimal, but unlike mask-composited inpainting, the pixels you keep are regenerated, not copied verbatim. If you need pixel-identical subjects, this isn't that tool.

Is it better than doing it locally? For a quick swap, honestly yes - no mask painting, no upscale-and-composite dance. For production control, you'll still want a local mask workflow. This node is the fast version of that idea.

Categoryaws

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
promptSTRING
mask_promptSTRING
num_imagesINT11–5
cfg_scaleFLOAT8.01.1–10
seedINT00–858993459

Outputs (1)

NameTypeDescription
IMAGEIMAGE