Image Engineering with Amazon Nova Canvas [🎥 Video Demo Included]
Mohamed Nizzad

Mohamed Nizzad @mohamednizzad

About: Data Scientist / AWS Certified (2X) ML Specialist | AWS ABW Grant Recipient '24 | 2 (Masters + Bachelors) | Researcher - NLP (Bias & Fairness) | Attorney-at-Law | Supervised 100+

Location:
Colombo, Sri Lanka
Joined:
Jan 9, 2025

Image Engineering with Amazon Nova Canvas [🎥 Video Demo Included]

Publish Date: May 19
8 1

Amazon Nova Canvas: AI-Powered Image Generation with AWS Bedrock

Amazon Nova Canvas is a powerful image generation application that leverages AWS Bedrock's image generation capabilities through a user-friendly Streamlit interface. The application enables users to create, manipulate, and customize images using advanced AI models with features like text-to-image generation, color-guided generation, and image-guided generation.

The application provides a comprehensive set of controls for image generation parameters including quality settings, dimensions, and prompt adherence. It supports multiple generation modes to accommodate different creative needs - from simple text prompts to sophisticated image variations guided by reference images or color palettes. All generated images and associated metadata are automatically saved and can be downloaded directly from the interface.

Image Engineering Project Demo

Repository Structure

.
├── amazon_image_gen.py           # Core image generation class using AWS Bedrock API
├── amazon_image_streamlit_app.py # Main Streamlit application interface
├── output/                       # Generated images and metadata storage
│   └── [timestamp]/             # Timestamped output directories containing:
│       ├── request.json         # Generation request parameters
│       ├── response_body.json   # API response with generated images
│       └── response_metadata.json# AWS response metadata
└── streamlit_requirements.txt    # Python package dependencies
Enter fullscreen mode Exit fullscreen mode

Usage Instructions

Prerequisites

  • Python 3.7 or higher
  • AWS account with Bedrock access
  • AWS credentials configured locally
  • Required Python packages:
    • boto3 >= 1.33.8
    • Pillow >= 10.1.0
    • ipywidgets >= 8.1.5
    • streamlit >= 1.30.0

Installation

Clone the repository:

git clone https://github.com/mohamednizzad/image-engeering-with-amazon-nova-canvas.git
cd image-engeering-with-amazon-nova-canvas
Enter fullscreen mode Exit fullscreen mode

Install dependencies:

pip install -r streamlit_requirements.txt
Enter fullscreen mode Exit fullscreen mode

Configure AWS credentials:

aws configure
Enter fullscreen mode Exit fullscreen mode

Quick Start

Launch the Streamlit application:

streamlit run amazon_image_streamlit_app.py
Enter fullscreen mode Exit fullscreen mode

Select a generation feature from the sidebar:

  • Simple Image Generation
  • Color-Guided Generation
  • Image-Guided Generation
  • Instant Customization
  • Background Replacement

Configure generation parameters:

  • Image quality (standard/premium)
  • Dimensions (width/height)
  • CFG Scale (prompt adherence)
  • Number of images
  • Seed value

Enter your prompt and generate images

GitHub Repository

  • Check GitHub Repository:- Repo

More Detailed Examples

Simple Image Generation

# Example text prompt
text_prompt = "A beautiful landscape with mountains and a lake at sunset"
negative_prompt = "clouds, people, text"

# Configure parameters
inference_params = {
    "taskType": "TEXT_IMAGE",
    "textToImageParams": {
        "text": text_prompt,
        "negativeText": negative_prompt,
    },
    "imageGenerationConfig": {
        "numberOfImages": 1,
        "quality": "standard",
        "width": 1024,
        "height": 768,
        "cfgScale": 7.0,
        "seed": 123456
    }
}
Enter fullscreen mode Exit fullscreen mode

Color-Guided Generation

# Example with color guidance
inference_params = {
    "taskType": "COLOR_GUIDED_GENERATION",
    "colorGuidedGenerationParams": {
        "text": "digital painting of a landscape",
        "colors": ["#81FC81", "#386739", "#C9D688"]
    },
    "imageGenerationConfig": {
        "numberOfImages": 1,
        "quality": "standard",
        "width": 1024,
        "height": 768
    }
}
Enter fullscreen mode Exit fullscreen mode

Troubleshooting

Common Issues:

  1. AWS Credentials Error

    • Error: "Failed to initialize AWS Bedrock client"
    • Solution: Verify AWS credentials in ~/.aws/credentials
    • Check region configuration in ~/.aws/config
  2. Image Generation Timeout

    • Error: "Read timeout error"
    • Solution: Adjust the boto3 client timeout in config
    • Default timeout is 300 seconds for multiple images
  3. Validation Errors

    • Error: "Malformed input request"
    • Solution: Ensure all required parameters are provided
    • Check minimum length requirements for text prompts

Debug Mode:

import logging
logging.basicConfig(level=logging.DEBUG)
Enter fullscreen mode Exit fullscreen mode

Data Flow

The application processes image generation requests through AWS Bedrock's API, handling both text-to-image and image-to-image transformations. The system manages request parameters, API communication, and response processing while maintaining a persistent output structure.

[User Input] -> [Streamlit Interface] -> [BedrockImageGenerator]
                                              |
                                        [AWS Bedrock API]
                                              |
[Output Directory] <- [Response Processing] <- [Generated Images]
Enter fullscreen mode Exit fullscreen mode

Key Component Interactions:

  1. User input captured through Streamlit interface
  2. Parameters validated and formatted for AWS Bedrock
  3. BedrockImageGenerator handles AWS API communication
  4. Generated images saved to timestamped directories
  5. Response metadata logged for tracking
  6. Images displayed in interface with download options
  7. Error handling and validation at each step

Checkout How you can use Amazon Q Developer to write code effortlessly

Comments 1 total

  • Ahamed Ahnaf
    Ahamed AhnafMay 19, 2025

    @mohamednizzad Impressive work Sir, This project is a standout example of how to leverage AWS Bedrock effectively for real world image engineering. The integration with Streamlit makes the tool both powerful and accessible, especially with support for text, color, and image guided generation modes. I really appreciate the thoughtful touches like metadata logging, configurable quality settings, and seamless export functionality which show a deep understanding of both developer and user needs. This will be incredibly valuable for creatives, researchers, and developers alike. Looking forward to seeing how this evolves.

Add comment