🌟 Pokémon TCG Collage Generator
A high-resolution collage generator using thousands of Pokémon TCG cards.
- Overview
- Project Structure
- Requirements
- Installation
- Dataset Download & Setup
- Color Preprocessing
- Generating The Collage
- Available Algorithms
- Collage Algorithm Parameters
- TIFF Support
- Images
- Performance Notes
- Troubleshooting
This project generates ultra-high-resolution image mosaics using Pokémon TCG card art. It loads an input image, splits it into blocks, and finds the closest matching Pokémon card for each block using LAB color distance, HSV weighting, saturation awareness, and optional rotation/displacement.
Outputs can reach 7000×7000 or more and are suitable for large prints and posters.
PokemonTCG-Gen/
│
├── populate-pokemon-db.py
├── preprocess-color-pokemon-db.py
├── aggregate-pokemon-images.py
│
├── Pokemon Mosaics - Database/
├── images/
├── input_test/
└── output_test/-
Python 3.10+
-
MySQL 8+
-
OpenCV
-
NumPy
-
TiffFile
-
MySQL Connector
-
Pillow
-
ColorMath
- Clone
git clone https://github.com/mmitzy/PokemonTCG-Gen.git
cd PokemonTCG-Gen- Create venv
python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txtRun:
python populate-pokemon-db.pyCreates all tables + downloads all official Pokémon TCG images + fills DB.
Run:
python preprocess-color-pokemon-db.pyThis computes average/median colors in RGB, HSV, LAB and stores them in MySQL.
Example (7K resolution):
python aggregate-pokemon-images.py input_test --algorithm collage --size 7000x7000 --timeout 9999 --output output_test/final.png --config "width=20,height=20,candidates=2000,prefilter=30,tolerance=8,saturation=0.4"-collage: The main Pokémon mosaic engine -average: Pixel averages -median: Pixel medians -average_row: Row collapsing -average_square: Block averages -similarity_heatmap: Card similarity map -compose_columns: Column-stacked composition -test: Debug mode
--config "width=20,height=20,candidates=2000,prefilter=30,tolerance=8,saturation=0.4,rotation=15,displacement=1"Parameter meanings:
-width,height: Tile size -candidates: SQL candidate depth -prefilter: LAB quick filter -tolerance: Max CIEDE2000 distance -saturation: Weight for color saturation -rotation: Random angle per tile -displacement: Pixel jitter -repeat: Allow card reuse
TIFF is recommended for huge outputs (≥4000×4000):
✔ Supports massive resolutions ✔ Lossless ✔ Photoshop/GIMP compatible ✔ deflate and lzw compression supported
Example:
--output output_test/final.tiff --compression deflateUNFINISHED, IMAGES ARE SOON TO BE ADDED
3. High – 4096×4096 4. Ultra High – 7000×7000 5. Sky Correction Before AfterLarge collages (7000×7000) can take 8-24 hours
Use --timeout 9999 to avoid automatic termination
Avoid system sleep mode
Increase candidates, prefilter, saturation for better color fidelity
❗ No candidates found
Increase:
prefilter=40
candidates=2500
tolerance=10❗ Sky turns red
Use:
saturation=0.4 or 0.5
prefilter=30+❗ Script stops
Add:
--timeout 9999






