Skip to content

amoskowitz02/ImageCollageAI

Repository files navigation

AI Art Mosaic Generator

Transform images into mosaics where each tile has a unique AI-generated artistic style while preserving the original structure and composition.

Example

How It Works

  1. Your image is transformed into N different artistic styles (one per tile)
  2. Each styled version preserves the original composition using Stability AI's Control Structure
  3. The corresponding tile is extracted from each styled image
  4. Tiles are combined into the final mosaic

Setup

1. Install Dependencies

cd /home/adam/image_collage
pip install -r requirements.txt

2. Configure API Keys

Copy the example env file and add your keys:

cp .env.example .env

Edit .env with your API keys:

OPENAI_API_KEY=sk-your-openai-key-here
STABILITY_API_KEY=sk-your-stability-key-here

Get your keys:

Usage

Basic Usage

python3 main.py your_image.jpg --grid 3x3

Full Options

python3 main.py <image_path> --grid <ROWSxCOLS> --strength <0.0-1.0>
Option Description Default
--grid, -g Grid size as ROWSxCOLS 3x3
--strength, -s Structure preservation (higher = more faithful) 0.9

Examples

# Simple 3x3 mosaic
python3 main.py photo.jpg

# 5x6 grid with strong structure preservation
python3 main.py photo.jpg -g 5x6 -s 0.9

# 2x2 quick test
python3 main.py photo.jpg -g 2x2 -s 0.85

Windows Paths (from WSL)

python3 main.py "/mnt/c/Users/OWNER/Downloads/photo.jpg" -g 3x3

Output

All outputs are saved to outputs/<image_name>_v<N>/:

outputs/photo_v1/
├── photo_mosaic.png              # Final mosaic
├── styled_0_0_Theme_Name.png     # Full styled image for tile (0,0)
├── styled_0_1_Another_Theme.png  # Full styled image for tile (0,1)
└── ...

Running the same image again auto-increments the version (_v2, _v3, etc.).

Control Strength Guide

The --strength parameter (0.0-1.0) controls how much of the original image structure is preserved:

  • Higher strength (0.9-0.95) = More structure preserved. The subject, background, and composition stay very close to the original. Style changes are applied to colors and textures while keeping shapes intact.

  • Lower strength (0.7-0.8) = More creative freedom. The AI takes more liberties with the composition. Subjects may be reimagined or transformed more dramatically.

Strength Effect
0.7 More creative, may alter composition
0.85 Balanced style and structure
0.9 Strong structure preservation (recommended)
0.95 Very close to original, subtle changes

Recommendation: Start with 0.9 for most images. Lower it if you want more dramatic artistic interpretation.

Cost Estimate

Each tile requires one Stability AI API call. Approximate costs:

  • 3x3 grid (9 tiles): ~$0.30-0.50
  • 4x4 grid (16 tiles): ~$0.50-0.80
  • 5x6 grid (30 tiles): ~$1.00-1.50

Requirements

  • Python 3.8+
  • OpenAI API key (for theme generation)
  • Stability AI API key (for style transfer)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages