YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

⬛ PixelForge

Transform any photo into stunning pixel art β€” with AI-powered face detection.

A full-stack platform inspired by Kling AI, built with Python (FastAPI) backend and React frontend. Upload any image and convert it to colored pixel art with smart face awareness (keep faces sharp or pixelate them for privacy).


✨ Features

Feature Description
πŸ”² Pixel Art Engine Convert any image to blocky pixel art (2–64px block size)
🎨 Color Palettes Game Boy, NES, Commodore 64, Cyberpunk, Pastel, Auto
πŸ‘€ Face Detection OpenCV Haar cascade β€” protect or pixelate detected faces
πŸ–ΌοΈ Drag & Drop Upload Direct upload from browser
✨ AI Generation Generate images from text prompt (requires OpenAI API key)
πŸ“₯ Download Export final PNG with one click
πŸ”² Grid Overlay Optional pixel grid for that authentic retro look

πŸ—‚οΈ Project Structure

pixelforge/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py             # FastAPI server β€” all image processing logic
β”‚   └── requirements.txt    # Python dependencies
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ public/index.html
β”‚   └── src/
β”‚       β”œβ”€β”€ index.js
β”‚       └── App.jsx         # React UI
β”œβ”€β”€ .env                    # Environment variables (DO NOT COMMIT)
β”œβ”€β”€ .env.example            # Template β€” safe to commit
└── README.md

πŸš€ Quick Start

1. Clone / unzip the repo

unzip pixelforge.zip
cd pixelforge

2. Configure environment

cp .env.example .env
# Edit .env with your values (optional: add OPENAI_API_KEY for AI generation)

3. Start the Python backend

cd backend
python -m venv venv
source venv/bin/activate          # Windows: venv\Scripts\activate
pip install -r requirements.txt
python main.py
# Server runs at http://localhost:8000

4. Start the React frontend

cd frontend
npm install
npm start
# App opens at http://localhost:3000

βš™οΈ Environment Variables

Variable Default Description
HOST 0.0.0.0 Backend host
PORT 8000 Backend port
DEBUG False Reload on code change
UPLOAD_DIR uploads Where uploads are temporarily stored
OUTPUT_DIR outputs Where processed images are saved
MAX_FILE_SIZE_MB 20 Max upload size
DEFAULT_PIXEL_SIZE 16 Default block size
OPENAI_API_KEY (optional) Enables AI prompt β†’ image β†’ pixel pipeline
STABILITY_API_KEY (optional) Alternative: Stability AI generation
SECRET_KEY β€” Change before deploying to production

🎨 Pixel Art Pipeline

Original Image
    β”‚
    β–Ό
Color Quantization  ← reduces palette to N colors
    β”‚
    β–Ό
Pixelation          ← downscale + upscale (nearest neighbor)
    β”‚
    β–Ό
Face Detection      ← OpenCV Haar cascade
    β”‚
    β”œβ”€ protect_faces=True  β†’ restore sharp face region
    └─ protect_faces=False β†’ apply heavier pixelation to faces
    β”‚
    β–Ό
Palette Mapping     ← (optional) snap to preset palette
    β”‚
    β–Ό
Grid Overlay        ← (optional) draw pixel grid lines
    β”‚
    β–Ό
Output PNG

πŸ”Œ API Endpoints

Method Path Description
GET / Health check
GET /palettes List available palette names
POST /upload Upload image file β†’ base64
POST /process Pixelate a base64 image
POST /generate-prompt Text β†’ AI image β†’ pixelate
GET /outputs/{filename} Download processed image

/process Request Body

{
  "image_b64": "data:image/png;base64,...",
  "pixel_size": 16,
  "num_colors": 16,
  "protect_faces": true,
  "face_pixel_size": 8,
  "add_grid": false,
  "palette": "nes"
}

πŸ› οΈ Tech Stack

  • Backend: Python 3.10+, FastAPI, Uvicorn, Pillow, OpenCV, NumPy
  • Frontend: React 18, plain CSS-in-JS (no extra deps)
  • AI (optional): OpenAI DALL-E 3 via openai SDK

πŸ“ License

MIT β€” use freely, attribution appreciated.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support