new·Earn with mozg — 20% of every monthSend somebody here and take a fifth of every plan payment they make, for as long as they keep paying — not a bounty on the first invoice. Your handle is the link, the window is thirty days, and the commission lands on your balance the second they pay. Free to join: if you have signed in, you already have the link. mozg.sh/earnall news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

bedrock/image-generation

15 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Bedrock image generation model

Amazon Bedrock provides the amazon.nova-canvas-v1:0 model for image generation. This model is available in us-east-1, eu-west-1, and ap-northeast-1 regions.

Bedrock Nova Canvas image generation provider options

For amazon.nova-canvas-v1:0, the following optional provider options are available under providerOptions.amazonBedrock: quality (string, accepts 'standard' or 'premium'), negativeText (string, text describing what you don't want in the generated image), cfgScale (number, controls how closely the generated image adheres to the prompt), style (string, accepts 3D_ANIMATED_FAMILY_FILM, DESIGN_SKETCH, FLAT_VECTOR_ILLUSTRATION, GRAPHIC_NOVEL_ILLUSTRATION, MAXIMALISM, MIDCENTURY_RETRO, PHOTOREALISM, SOFT_DIGITAL_PAINTING).

Bedrock Nova Canvas image size constraints

The Amazon Nova Canvas model (amazon.nova-canvas-v1:0) supports custom sizes with the following constraints: each side must be between 320-4096 pixels inclusive, each side must be evenly divisible by 16, aspect ratio must be between 1:4 and 4:1, total pixel count must be less than 4,194,304.

Bedrock image editing task types

Amazon Nova Canvas supports the following image editing task types: TEXT_IMAGE (default for text-only), IMAGE_VARIATION, INPAINTING, OUTPAINTING, BACKGROUND_REMOVAL. When images are provided without an explicit taskType, the model defaults to IMAGE_VARIATION, or INPAINTING if a mask is provided.

Bedrock image variation provider options

For IMAGE_VARIATION task type, the following provider option is available: similarityStrength (number, range 0.2-1.0, higher values produce results closer to the original).

Bedrock inpainting provider options

For INPAINTING task type, the following provider option is available: maskPrompt (string, a text description of the area to modify, the model will automatically identify and mask the described region). Alternatively, a mask image can be provided where white pixels indicate the area to change.

Bedrock outpainting provider options

For OUTPAINTING task type, the following provider options are available: maskPrompt (string, text description of the area to modify), outPaintingMode (string, accepts 'DEFAULT' or 'PRECISE', controls how the outpainting is performed).

Bedrock image generation provider options for all editing modes

The following additional provider options are available for image editing in all modes: taskType (string, explicitly set the editing task type), maxImagesPerCall (number, override the maximum number of images generated per API call).

Example: Bedrock image generation

import { amazonBedrock } from '@ai-sdk/amazon-bedrock'; import { generateImage } from 'ai'; const { image } = await generateImage({ model: amazonBedrock.image('amazon.nova-canvas-v1:0'), prompt: 'A beautiful sunset over a calm ocean', size: '512x512', seed: 42, });

Example: Bedrock image generation with provider options

import { amazonBedrock, type AmazonBedrockImageModelOptions } from '@ai-sdk/amazon-bedrock'; import { generateImage } from 'ai'; const { image } = await generateImage({ model: amazonBedrock.image('amazon.nova-canvas-v1:0'), prompt: 'A beautiful sunset over a calm ocean', size: '512x512', seed: 42, providerOptions: { amazonBedrock: { quality: 'premium', negativeText: 'blurry, low quality', cfgScale: 7.5, style: 'PHOTOREALISM', } satisfies AmazonBedrockImageModelOptions, }, });

Example: Bedrock image variation

import { readFileSync } from 'fs'; import { amazonBedrock, type AmazonBedrockImageModelOptions } from '@ai-sdk/amazon-bedrock'; import { generateImage } from 'ai'; const imageBuffer = readFileSync('./input-image.png'); const { images } = await generateImage({ model: amazonBedrock.image('amazon.nova-canvas-v1:0'), prompt: { text: 'Modernize the style, photo-realistic, 8k, hdr', images: [imageBuffer], }, providerOptions: { amazonBedrock: { taskType: 'IMAGE_VARIATION', similarityStrength: 0.7, negativeText: 'bad quality, low resolution', } satisfies AmazonBedrockImageModelOptions, }, });

Example: Bedrock inpainting with mask prompt

import { readFileSync } from 'fs'; import { amazonBedrock, type AmazonBedrockImageModelOptions } from '@ai-sdk/amazon-bedrock'; import { generateImage } from 'ai'; const imageBuffer = readFileSync('./input-image.png'); const { images } = await generateImage({ model: amazonBedrock.image('amazon.nova-canvas-v1:0'), prompt: { text: 'a cute corgi dog in the same style', images: [imageBuffer], }, providerOptions: { amazonBedrock: { maskPrompt: 'cat', } satisfies AmazonBedrockImageModelOptions, }, seed: 42, });

Example: Bedrock inpainting with mask image

import { readFileSync } from 'fs'; import { amazonBedrock } from '@ai-sdk/amazon-bedrock'; import { generateImage } from 'ai'; const image = readFileSync('./input-image.png'); const mask = readFileSync('./mask.png'); const { images } = await generateImage({ model: amazonBedrock.image('amazon.nova-canvas-v1:0'), prompt: { text: 'A sunlit indoor lounge area with a pool containing a flamingo', images: [image], mask: mask, }, });

Example: Bedrock outpainting

import { readFileSync } from 'fs'; import { amazonBedrock, type AmazonBedrockImageModelOptions } from '@ai-sdk/amazon-bedrock'; import { generateImage } from 'ai'; const imageBuffer = readFileSync('./input-image.png'); const { images } = await generateImage({ model: amazonBedrock.image('amazon.nova-canvas-v1:0'), prompt: { text: 'A beautiful sunset landscape with mountains', images: [imageBuffer], }, providerOptions: { amazonBedrock: { taskType: 'OUTPAINTING', maskPrompt: 'background', outPaintingMode: 'DEFAULT', } satisfies AmazonBedrockImageModelOptions, }, });

Example: Bedrock background removal

import { readFileSync } from 'fs'; import { amazonBedrock, type AmazonBedrockImageModelOptions } from '@ai-sdk/amazon-bedrock'; import { generateImage } from 'ai'; const imageBuffer = readFileSync('./input-image.png'); const { images } = await generateImage({ model: amazonBedrock.image('amazon.nova-canvas-v1:0'), prompt: { images: [imageBuffer], }, providerOptions: { amazonBedrock: { taskType: 'BACKGROUND_REMOVAL', } satisfies AmazonBedrockImageModelOptions, }, });

Give your agent this brain