photogen.mov
Face Detection via MediaPipe BlazeFace with Haar cascade fallback
Background Removal using BiRefNet-portrait + alpha matting
Auto-Crop to exact government specs (head %, eye position, dimensions)
Enhancement with white balance + adaptive CLAHE contrast
Post-Processing sliders for brightness, contrast, saturation
Manual Crop with oval face template and alignment guides
Before / After side-by-side comparison slider
Print Sheet 4-up grid ready for photo center printing
300 DPI publication-quality JPEG export
Compliance Validation for dimensions, head size, eye position, file size
10+ Country Specs including US, EU, UK, Canada, Australia, India, China, Japan
Wide Format Support for HEIC, AVIF, JPEG, PNG, WebP, BMP
100% Free with no accounts or watermarks
Privacy First with no data stored on server
graph LR
A[📷 Upload] --> B[🎯 Face Detection]
B --> C[✂️ Background Removal]
C --> D[📐 Auto-Crop]
D --> E[🎨 Enhancement]
E --> F[💎 300 DPI Output]
Loading
Requirement
Version
Python
3.11+
Node.js
18+
cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000
The ML model (~170MB BiRefNet) downloads automatically on first request.
cd frontend
npm install
npm run dev
Open http://localhost:3000
Document
Country
Size
Head Height
Background
US Passport
🇺🇸 United States
2x2" (600x600px)
50-69%
White
US Visa
🇺🇸 United States
2x2" (600x600px)
50-69%
White
EU Passport
🇪🇺 EU / Schengen
35x45mm (413x531px)
70-80%
Light Gray
UK Passport
🇬🇧 United Kingdom
35x45mm (413x531px)
70-80%
Light Gray
Canada Passport
🇨🇦 Canada
35x45mm (420x540px)
71%
White
Australia Passport
🇦🇺 Australia
35x45mm (413x531px)
75%
White
India Passport
🇮🇳 India
35x45mm (413x531px)
75%
White
China Visa
🇨🇳 China
33x48mm (390x567px)
70%
White
Japan Passport
🇯🇵 Japan
35x45mm (413x531px)
70%
White
Germany Passport
🇩🇪 Germany
35x45mm (413x531px)
75%
Light Gray
Backend Frontend
Library
Purpose
FastAPI + Uvicorn
API server
MediaPipe
Face detection
OpenCV
Haar cascade fallback
rembg (BiRefNet)
Background removal
PyMatting
Alpha matting
Pillow + pillow-heif
Image I/O
scikit-image
CLAHE enhancement
Library
Purpose
Next.js 16 + React 19
App framework
TypeScript
Type safety
Tailwind CSS 4
Styling
react-easy-crop
Manual crop
Axios
HTTP client
Method
Endpoint
Description
POST
/api/process
Full processing pipeline
POST
/api/detect-face
Face detection only
POST
/api/remove-background
Background removal only
GET
/api/requirements
All country photo specs
GET
/api/requirements/{code}
Single country spec
GET
/api/health
Health check
Click to expand
photogen/
├── backend/
│ ├── app/
│ │ ├── api/routes/
│ │ ├── core/
│ │ ├── services/
│ │ ├── models/
│ │ └── data/
│ ├── Dockerfile
│ └── requirements.txt
├── frontend/
│ ├── app/
│ └── src/
│ ├── components/
│ ├── hooks/
│ ├── lib/
│ └── constants/
└── shared/
└── photo_requirements.json
Service
Platform
Notes
Frontend
Vercel
Edge CDN, auto-deploy from main
Backend
HuggingFace Spaces
Docker, 16GB RAM, 2 vCPU
The backend Dockerfile is configured for HuggingFace Spaces with pre-downloaded models.
MIT