Many customers in sectors such as creative advertising, media and entertainment, ecommerce, and fashion often need to change the background in a large number of images, which usually involves a time-consuming manual editing process for each image. Amazon Bedrock, in conjunction with AWS Step Functions, makes it easy to automate the process of changing backgrounds in multiple images at scale by using its generative AI foundation model – Amazon Titan Image Generator G1.
The Titan Image Generator G1 model can automatically change the background of an image using a technique called outpainting. AWS Step Functions enables users to create an automated workflow that seamlessly integrates with Amazon Bedrock and other AWS services, automating and simplifying the entire process of changing backgrounds across various images.
The process starts when a user uploads multiple images into an Amazon Simple Storage Service (S3) bucket via a Streamlit web app. The app calls an Amazon API Gateway REST API endpoint that integrates with Amazon Rekognition’s DetectLabels API, which retrieves labels for each image. The Streamlit app updates an Amazon DynamoDB table with image information, which triggers an AWS Lambda function, starting a Step Functions workflow. This workflow manages the changing of the image backgrounds, resulting in new images being saved to an S3 location, and updates the image status in DynamoDB.
After the image generation process, Step Functions generates a status report and sends an email containing details such as the S3 location for the status report and final image files via Amazon Simple Notification Service (SNS). Ultimately, the solution efficiently changes the backgrounds of images in parallel, enhancing productivity and scalability.
To deploy the solution, detailed instructions are provided in a GitHub repository.
The Titan Image Generator G1 model supports several parameters for image generation, including the type of outpainting method, prompts for defining the background and what not to include in the image, and image generation configurations such as the number of images to generate, quality, and dimensions.
The Titan Image Generator G1 model, Amazon Bedrock, and AWS Step Functions can be formidable tools for businesses seeking to automate and scale their image editing processes. They allow for efficient, productive, and scalable change of image backgrounds, facilitating various business operations in sectors like advertising, media, ecommerce, and fashion.