

# Generate an image with the Amazon Bedrock image and video playground
<a name="explore-image-playground"></a>

The image and video playground is an interactive environment that lets you specify actions that generate and manipulate images using natural language prompts, reference images, and suitable Amazon Bedrock models. 

## Actions for generating images
<a name="bedrock-image-actions"></a>

Within the image playground, you use an *action* to specify the image generation task that you want the model to do, such as replacing the background of an existing image. The actions that are available depends on the model you use.
+ **Generate image** — [Generates a new image](bedrock-image-playground-generate-image.md) from a prompt that you enter.
+ **Generate variations** — Use a prompt to generate a [variation of an existing image](bedrock-image-playground-generate-variations.md).
+ **Remove object** — [Removes an object](bedrock-image-playground-remove-object.md) from an image you supply. 
+ **Replace background** — [Replaces the background](bedrock-image-playground-replace-background.md) of an image with a new background. 
+ **Replace object** — [Replaces an object](bedrock-image-playground-replace-object.md) in an image with a different object.
+ **Edit image sandbox** — An [image sandbox](bedrock-image-playground-image-sandbox.md) that you can use to expiriment with Stable Diffusion XL models. 

Some actions, such as generate variation, require a reference image that a model uses to generate a new image. An action might require you to use a mask tool to draw a bounding box around an area of the reference image, such as when you define an object that you want to remove with the remove object action. 

## Configuration options
<a name="bedrock-image-configuration"></a>

You can influence how a model generates an image by configuring the following options. The configuration changes you can make depends on the action you choose. 

### Negative prompt
<a name="bedrock-image-negative-prompt"></a>

A set of words or phrases that that tells the model what not to include in the image that it generates. For example, you can use the term *-lowres* to avoid generating low-resolution or blurry images.

### Reference image
<a name="bedrock-image-reference-image"></a>

In certain actions, such as generate variations or replace background, you specify a reference image that the model uses to process the action.

### Response image
<a name="bedrock-image-response-image"></a>

You can specify the image dimensions, orientation, and number of images to generate.

### Advanced configuration options
<a name="bedrock-image-advanced-configurations"></a>

You can make advanced configuration changes that how the model generates images. All models image generation models support the following: 
+ **Prompt strength** — Prompt strength is a numerical value that determines how strongly a model should adhere to the given text prompt. A higher prompt strength means the model will try to closely follow and prioritize the text description provided in the prompt when generating the image. Lower prompt strengths allow the model more creative freedom to deviate from the prompt.
+ **Seed** — A seed is numeric value that a model uses to seed a random number generator. The model uses the seed as a starting point for creating random patterns during image generation. This initial randomness influences things like the exact positioning, colors, textures, and compositions present in the image that the model generates. 
+ **Similarity strength** — If you use the *Generate variations* action with a Titan Image Generator G1 V1 or a Titan Image Generator G1 V2 model, you can also configure the *Similarity Strength* advanced configuration. Similarity Strength specifies how similar the generated image should be to the input image. Use a lower value to introduce more randomness into the generated image. 
+ **Generate step** — If you use a Stable Diffusion XL model, you can configure the *Generate step* advanced configuration. Generate step determines how many times the image is sampled. More steps can result in a more accurate result.

**Topics**
+ [

### Negative prompt
](#bedrock-image-negative-prompt)
+ [

### Reference image
](#bedrock-image-reference-image)
+ [

### Response image
](#bedrock-image-response-image)
+ [

### Advanced configuration options
](#bedrock-image-advanced-configurations)

# Generate an image
<a name="bedrock-image-playground-generate-image"></a>

The following procedure shows you how to use a model to generate an image. You can set various configurations such as the number of images to generate and how strongly the prompt affects the generation of the image. For more information, see [Configuration options](explore-image-playground.md#bedrock-image-configuration).

**To generate an image in the image playground**

1. Navigate to the Amazon SageMaker Unified Studio landing page by using the URL from your administrator.

1. Access Amazon SageMaker Unified Studio using your IAM or single sign-on (SSO) credentials. For more information, see [Access Amazon SageMaker Unified Studio](getting-started-access-the-portal.md).

1. At the top of the page, choose the **Discover**.

1. In the **GENERATIVE AI** section, choose **Image and video playground**.

1. If the **Configurations** pane isn't open, choose the configuration button.

1. For **Model** select a model to use.

1. For **Action** choose the action **Generate image**.

1. In **Response image** do the following:

   1. For **Number of images** select the number of images that you want the model to generate. Not all models support changing this value.

   1. For **Orientation**, choose the orientation (landscape or portrait) for the images that the model generates.

   1. For **Size**, select the size, in pixels, of the images that the model generates. 

1. (Optional) In **Advanced configurations**, change how the model generates images by making advanced configuration changes. For more information, see [Advanced configuration options](explore-image-playground.md#bedrock-image-advanced-configurations).

1. In the **Enter prompt** text box, enter **Create a photo of a local classic rock band playing on an outdoor stage.**. Alternatively, enter a prompt of your choosing.

1. Press Enter on your keyboard to start the action. Amazon Bedrock in SageMaker Unified Studio shows the image that the model generates in the playground.

1. (Optional) See how different configuration parameters affect image generation by repeating steps 9 - 11 with different values. 

# Generate a variation of an image
<a name="bedrock-image-playground-generate-variations"></a>

The following procedure shows you how to generate a variation of a reference image that you supply. You can set various configurations such as the number of images to generate and how strongly the prompt affects the generation of the image. For more information, see [Configuration options](explore-image-playground.md#bedrock-image-configuration).

**To generate a variation of an image**

1. Navigate to the Amazon SageMaker Unified Studio landing page by using the URL from your administrator.

1. Access Amazon SageMaker Unified Studio using your IAM or single sign-on (SSO) credentials. For more information, see [Access Amazon SageMaker Unified Studio](getting-started-access-the-portal.md).

1. At the top of the page, choose the **Discover**.

1. In the **GENERATIVE AI** section, choose **Image and video playground**.

1. If the **Configurations** pane isn't open, choose the configuration button.

1. For **Model** select a model to use.

1. For **Action** choose **Generate variations**.

1. (Optional) For **Negative prompt** enter text that describes content or concepts that you do not want the model to include in the image.

1. In **Reference image** choose **Upload image** and upload the image that you want the model to use with the action. 

1. In **Response image** do the following:

   1. For **Number of images** select the number of images that you want the model to generate. Not all models support changing this value.

   1. For **Orientation**, choose the orientation (landscape or portrait) for the images that the model generates.

   1. For **Size**, select the size, in pixels, of the images that the model generates. 

1. (Optional) In **Advanced configurations**, change how the model generates images by making advanced configuration changes. For more information, see [Advanced configuration options](explore-image-playground.md#bedrock-image-advanced-configurations).

1. In the **Enter prompt** text box, enter the prompt that describes the image that you want the model to generate.

1. Press Enter on your keyboard to start the action. Amazon Bedrock in SageMaker Unified Studio shows the image that the model generates in the playground.

# Remove an object from an image
<a name="bedrock-image-playground-remove-object"></a>

The following procedure shows you how to use a model to remove an object from an image that you supply. For example, you could remove an unwanted person from an image. You can set various configurations such as the number of images to generate and how strongly the prompt affects the generation of the image. For more information, see [Configuration options](explore-image-playground.md#bedrock-image-configuration).

**Note**  
The object removal action is only available with Titan Image Generator G1 V1 and Titan Image Generator G1 V2 models.

**To remove an object from an image**

1. Navigate to the Amazon SageMaker Unified Studio landing page by using the URL from your administrator.

1. Access Amazon SageMaker Unified Studio using your IAM or single sign-on (SSO) credentials. For more information, see [Access Amazon SageMaker Unified Studio](getting-started-access-the-portal.md).

1. At the top of the page, choose the **Discover**.

1. In the **GENERATIVE AI** section, choose **Image and video playground**.

1. If the **Configurations** pane isn't open, choose the configuration button.

1. For **Model** select a model to use.

1. For **Action** choose **Remove object**.

1. (Optional) For **Negative prompt** enter text that describes content or concepts that you don't want the model to include in the image.

1. In **Reference image** choose **Upload image** and upload the image that you want the model to use with the action. 

1. (Optional) For **Negative prompt** enter text that describes content or concepts that you do not want the model to include in the image.

1. (Optional) In **Advanced configurations**, change how the model generates images by making advanced configuration changes. For more information, see [Advanced configuration options](explore-image-playground.md#bedrock-image-advanced-configurations).

1. In the center pane, use the masking tool to draw a bounding box around the area of the image that you want the action to update. You can do the following:

   1. Resize the bounding box by selecting a corner of the bounding box with your mouse button. Then, drag the mouse to resize the bounding box. Release the mouse button to complete resizing the bounding box.

   1. Move the bounding box by selecting the interior of the bounding box with your mouse button. Move the bounding box to the new location and release the mouse button.

1. Press Enter on your keyboard to start the action. Amazon Bedrock in SageMaker Unified Studio shows the image that the model generates in the playground.

# Replace an object in an image
<a name="bedrock-image-playground-replace-object"></a>

The following procedure shows you how to use a model to replace an object in an image that you supply. For example, you could replace a piece of furniture in an image with a different piece of furniture. You can set various configurations such as the number of images to generate and how strongly the prompt affects the generation of the image. For more information, see [Configuration options](explore-image-playground.md#bedrock-image-configuration).

**Note**  
The object replacement action is only available with Titan Image Generator G1 V1 and Titan Image Generator G1 V2 models.

**To replace an object in an image**

1. Navigate to the Amazon SageMaker Unified Studio landing page by using the URL from your administrator.

1. Access Amazon SageMaker Unified Studio using your IAM or single sign-on (SSO) credentials. For more information, see [Access Amazon SageMaker Unified Studio](getting-started-access-the-portal.md).

1. At the top of the page, choose the **Discover**.

1. In the **GENERATIVE AI** section, choose **Image and video playground**.

1. If the **Configurations** pane isn't open, choose the configuration button.

1. For **Model** select a model to use.

1. For **Action** choose **Remove object**.

1. (Optional) For **Negative prompt** enter text that describes content or concepts that you do not want the model to include in the image.

1. In **Reference image** choose **Upload image** and upload the image that you want the model to use with the action. 

1. (Optional) In **Advanced configurations**, change how the model generates images by making advanced configuration changes. For more information, see [Advanced configuration options](explore-image-playground.md#bedrock-image-advanced-configurations).

1. In the center pane, use the masking tool to draw a bounding box around the area of the image that you want the action to update. You can do the following:

   1. Resize the bounding box by selecting a corner of the bounding box with your mouse button. Then, drag the mouse to resize the bounding box. Release the mouse button to complete resizing the bounding box.

   1. Move the bounding box by selecting the interior of the bounding box with your mouse button. Move the bounding box to the new location and release the mouse button.

1. Choose the run button on your keyboard to start the action. Amazon Bedrock in SageMaker Unified Studio shows the image that the model generates in the playground.

# Replace the background for an image
<a name="bedrock-image-playground-replace-background"></a>

The following procedure shows you how to use a model to replace the background for an image. For example, you could change the background for an image from a view of a forest to a view of city buildings. You can set various configurations such as the number of images to generate and how strongly the prompt affects the generation of the image. For more information, see [Configuration options](explore-image-playground.md#bedrock-image-configuration).

**Note**  
The background replacement action is only available with Titan Image Generator G1 V1 and Titan Image Generator G1 V2 models.

**To replace the background for an image**

1. Navigate to the Amazon SageMaker Unified Studio landing page by using the URL from your administrator.

1. Access Amazon SageMaker Unified Studio using your IAM or single sign-on (SSO) credentials. For more information, see [Access Amazon SageMaker Unified Studio](getting-started-access-the-portal.md).

1. At the top of the page, choose the **Discover**.

1. In the **GENERATIVE AI** section, choose **Image and video playground**.

1. If the **Configurations** pane isn't open, choose the configuration button.

1. For **Model** select a model to use.

1. For **Action** choose **Replace background**.

1. (Optional) For **Negative prompt** enter text that describes content or concepts that you don't want the model to include in the image.

1. In **Reference image** choose **Upload image** and upload the image that you want the model to use with the action. 

1. (Optional) For **Negative prompt** enter text that describes content or concepts that you do not want the model to include in the image.

1. (Optional) In **Advanced configurations**, change how the model generates images by making advanced configuration changes. For more information, see [Advanced configuration options](explore-image-playground.md#bedrock-image-advanced-configurations).

1. In the center pane, use the masking tool to draw a bounding box around the area of the image that you want the action to preserve. The model updates the area outside of the bounding box. You can do the following:

   1. Resize the bounding box by selecting a corner of the bounding box with your mouse button. Then, drag the mouse to resize the bounding box. Release the mouse button to complete resizing the bounding box.

   1. Move the bounding box by selecting the interior of the bounding box with your mouse button. Move the bounding box to the new location and release the mouse button.

1. In the **Enter prompt** text box, enter a prompt that describes the background that you want the image to have.

1. Press Enter on your keyboard to start the action. Amazon Bedrock in SageMaker Unified Studio shows the image that the model generates in the playground.

# Edit an image with the image sandbox
<a name="bedrock-image-playground-image-sandbox"></a>

If you use the image playground with a Stable Diffusion XL model, you can use the image sandbox to make changes to a model.

**Note**  
The image sandbox action is only available with Stable Diffusion XL models.

**To edit an image in the image sandbox**

1. Navigate to the Amazon SageMaker Unified Studio landing page by using the URL from your administrator.

1. Access Amazon SageMaker Unified Studio using your IAM or single sign-on (SSO) credentials. For more information, see [Access Amazon SageMaker Unified Studio](getting-started-access-the-portal.md).

1. At the top of the page, choose the **Discover**.

1. In the **GENERATIVE AI** section, choose **Image and video playground**.

1. If the **Configurations** pane isn't open, choose the configuration button.

1. For **Model** select a model to use.

1. For **Action** choose **Remove object**.

1. (Optional) For **Negative prompt** enter text that describes content or concepts that you do not want the model to include in the image.

1. In **Reference image** choose **Upload image** and upload the image that you want the model to use with the action. 

1. (Optional) In **Advanced configurations**, change how the model generates images by making advanced configuration changes. For more information, see [Advanced configuration options](explore-image-playground.md#bedrock-image-advanced-configurations).

1. In the center pane, use the masking tool to draw a bounding box around the area of the image that you want the action to update. You can do the following:

   1. Resize the bounding box by selecting a corner of the bounding box with your mouse button. Then, drag the mouse to resize the bounding box. Release the mouse button to complete resizing the bounding box.

   1. Move the bounding box by selecting the interior of the bounding box with your mouse button. Move the bounding box to the new location and release the mouse button.

1. In the **Enter prompt** text box, enter the prompt that describes the edit that that you want the model inside the bounding box. 

1. Press Enter on your keyboard to start the action. Amazon Bedrock in SageMaker Unified Studio shows the image that the model generates in the playground.