An AI-powered comic creation system using Strands Agents and Nano Banana Pro (Gemini 3 Pro Image)
Generate professional-quality comics from natural language descriptions using Google's state-of-the-art image generation model and the Strands Agents framework.
- 🤖 Intelligent Agent: Uses Strands framework for smart task orchestration
- 🎨 Nano Banana Pro: Powered by Gemini 3 Pro Image for high-quality visuals
- 📚 Multi-Panel Comics: Create single panels or complete comic pages
- 💬 Text Overlays: Add speech bubbles and captions automatically
- 🎭 Style Customization: Choose from various art styles and formats
- ⚡ Async Support: Generate comics with streaming or async patterns
- Python 3.8 or higher
- Google AI API key (Get one free)
-
Clone and navigate to the project
cd gio-comics -
Set up virtual environment
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure API key
cp .env.example .env # Edit .env and add your GOOGLE_API_KEY -
Verify installation
python demo.py
from comic_agent import ComicGeneratorAgent
# Initialize the agent
agent = ComicGeneratorAgent()
# Generate a comic
result = agent.create_comic("""
Create a 3-panel comic about a robot discovering emotions:
Panel 1: Robot analyzing data in a sterile lab
Panel 2: Robot encounters a friendly kitten
Panel 3: Robot experiencing joy for the first time
Style: Warm colors, heartwarming, clean illustration
""")
print(result)
# Comics saved to: output/panel_01.png, output/panel_02.png, etc.python examples/interactive.pyThen enter your comic ideas:
> Create a 4-panel superhero origin story
> Make a funny comic about a cat and a laser pointer
> Generate a manga-style battle scene
# Simple robot comic (recommended first test)
python examples/simple_comic.py
# Noir detective comic with custom panels
python examples/custom_panels.py
# Real-time streaming generation
python examples/streaming_example.pyInitialize the comic generator with custom configuration.
agent = ComicGeneratorAgent(
api_key="your_key", # Optional: defaults to env var
model_id="gemini-2.5-flash" # Optional: Gemini model to use
)Generate a comic synchronously.
response = agent.create_comic("Create a 2-panel comic about a wizard")Generate a comic asynchronously.
response = await agent.create_comic_async("Create a space adventure comic")Generate with real-time streaming updates.
async for event in agent.create_comic_streaming("Create a fantasy comic"):
# Process streaming events
passThe agent has access to specialized comic creation tools:
| Tool | Description | Parameters |
|---|---|---|
generate_comic_panel |
Create a single panel | panel_description, panel_number, aspect_ratio, image_size, style |
create_text_overlay |
Add text to panels | panel_path, text, position, font_size |
combine_panels |
Merge panels into a page | panel_paths, layout, output_name |
generate_complete_comic |
Full multi-panel generation | story_description, num_panels, aspect_ratio, style |
Create a .env file in the project root:
GOOGLE_API_KEY=your_google_ai_api_key_hereDefault model: gemini-2.5-flash (recommended for best balance of quality and speed)
Available models:
gemini-2.5-pro- Highest quality, slowergemini-2.5-flash- Best balance (default)gemini-2.5-flash-lite- Fastest, most economical
Customize in comic_tools.py:
# Aspect ratios: "1:1", "16:9", "9:16", "4:3", "3:4"
# Image sizes: "1K", "2K", "4K"gio-comics/
├── comic_agent.py # Main agent implementation
├── comic_tools.py # Nano Banana Pro tools
├── demo.py # Quick test script
├── requirements.txt # Python dependencies
├── .env # API keys (create from .env.example)
├── examples/ # Usage examples
│ ├── simple_comic.py # Basic example
│ ├── custom_panels.py # Advanced panel control
│ ├── interactive.py # Interactive CLI
│ └── streaming_example.py # Streaming demo
├── output/ # Generated comics (auto-created)
├── test_setup.py # Installation validator
└── test_agent.py # Agent tests
# Comic book style
agent.create_comic("""
Create a 3-panel superhero comic in classic comic book style
with bold outlines, vibrant colors, and dynamic action
""")
# Manga style
agent.create_comic("""
Create a 4-panel manga-style comic with dramatic expressions,
speed lines, and typical manga panel layouts
""")
# Watercolor
agent.create_comic("""
Create a 2-panel comic in soft watercolor style with
gentle colors and flowing artistic elements
""")agent.create_comic("""
Create a 3-panel noir detective comic:
Panel 1 (Close-up): Detective's face half in shadow,
rain visible through window, cigarette smoke curling up,
dramatic lighting with venetian blind shadows
Panel 2 (Wide shot): Dark alley at night, rain pouring,
mysterious figure in long coat under flickering streetlight,
puddles reflecting the light
Panel 3 (Over-shoulder): Detective looking at evidence
photos on desk, dramatic desk lamp creating stark shadows,
noir atmosphere
Style: Film noir with high contrast black and white
""")❌ Error: Google API key not foundSolution:
# Check .env file exists
ls -la .env
# Verify content
cat .env
# Should show: GOOGLE_API_KEY=your_key_here❌ Error: 429 RESOURCE_EXHAUSTEDSolution:
- Wait 1-2 minutes (free tier has rate limits)
- Monitor usage: https://ai.dev/usage
- Consider upgrading to paid tier
❌ EOFError: EOF when reading a lineSolution: Run in an actual terminal, not through automation:
python examples/interactive.py
# Then type your prompts❌ ModuleNotFoundError: No module named 'strands'Solution:
# Ensure virtual environment is activated
source venv/bin/activate
# Reinstall dependencies
pip install -r requirements.txtRun the test suite to verify everything works:
# Validate installation
python test_setup.py
# Test agent functionality
python test_agent.py
# Quick demo
python demo.py✅ Good:
Create a 3-panel comic:
Panel 1: Young wizard discovers ancient spellbook in dusty library
Panel 2: Wizard attempts first spell, magical energy swirling
Panel 3: Spell goes hilariously wrong, books flying everywhere
Style: Colorful fantasy art with magical effects
❌ Less effective:
Make a wizard comic
- Be specific - Describe characters, settings, emotions, and actions
- Use camera angles - "close-up", "wide shot", "bird's eye view"
- Specify mood - Lighting, weather, atmosphere
- Choose art style - Comic book, manga, watercolor, noir, etc.
- Start simple - Try 2-3 panels first, then expand
┌─────────────────────────────────────┐
│ Comic Generator Agent (Strands) │
│ - Natural language understanding │
│ - Tool orchestration │
│ - Story planning │
└────────────┬────────────────────────┘
│
├─> generate_comic_panel
├─> create_text_overlay
├─> combine_panels
└─> generate_complete_comic
│
↓
┌─────────────────────┐
│ Nano Banana Pro │
│ (Gemini 3 Pro) │
│ - Image generation │
│ - Text rendering │
└─────────────────────┘
- strands-agents[gemini] - Agent framework with Gemini support
- google-genai - Google AI API client
- pillow - Image manipulation
- python-dotenv - Environment management
- Generation time: 5-15 seconds per panel (varies by complexity)
- Resolution: Up to 4K (configurable)
- Rate limits: Free tier allows ~15 RPM (requests per minute)
- Strands Agents - Agent framework documentation
- Gemini API - Google AI documentation
- Nano Banana Pro - Image generation guide
- Google AI Studio - Get API keys and test models
- Report issues: Create an issue in this repository
- Feature requests: Open a discussion
- Examples: Check the
examples/directory
# Installation validation
python test_setup.py
# Agent functionality
python test_agent.py
# All examples
for script in examples/*.py; do
echo "Testing $script..."
python "$script"
doneThe project follows these principles:
- Clean, readable code
- Type hints for better IDE support
- Comprehensive error handling
- Detailed documentation
MIT License - See LICENSE file for details
- Strands Agents - Powerful agent framework
- Google DeepMind - Nano Banana Pro (Gemini 3 Pro Image)
- Anthropic - Claude for development assistance
Contributions are welcome! Areas for improvement:
- Additional art styles
- More panel layout options
- Enhanced text rendering
- Character consistency across panels
- Story template library
Made with ❤️ using Strands Agents and Nano Banana Pro