Spaces:
Running
Running
File size: 2,363 Bytes
4cb7ab8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # Visa Photo Maker Documentation
## Overview
Visa Photo Maker is a privacy-first, bilingual web application that automatically processes user-uploaded photos into standard visa/passport photo formats. It uses AI to remove backgrounds and intelligently crops the image to meet specific aspect ratios and composition requirements.
## Privacy & Security
**Does the server keep my photos?**
**NO.**
- Images are processed in **RAM (Memory)** only.
- The backend receives the file -> Removes Background -> Crops -> Returns the result immediately.
- No `save()` to disk operations are performed for user images.
- Once the request is finished, the data is discarded by the server's garbage collector.
## Features
- **AI Background Removal:** Uses `rembg` (U2-Net) to remove complex backgrounds.
- **Smart Cropping:**
- Automatically detects the subject.
- Cleans up semi-transparent noise.
- Crops excess body parts for correct head-to-body ratios.
- Ensures no white borders ("Cover Mode").
- **Internationalization (i18n):**
- Full support for 6 languages:
- π¨π³ Chinese (ZH)
- πΊπΈ English (EN)
- πͺπΈ Spanish (ES)
- π«π· French (FR)
- π―π΅ Japanese (JA)
- π°π· Korean (KO)
- Dedicated SEO-friendly routes (e.g., `/es`, `/ja`).
- **Multi-Standard Support:**
- US/India: 2x2 inch (600x600 px)
- Europe/UK/China: 35x45 mm
- Japan: 30x40 mm
- Canada: 50x70 mm
- **Queue System:** Strict "One at a time" processing to protect server resources.
## API Reference
### `POST /process-image`
Uploads an image and returns the processed JPEG.
**Parameters (Form Data):**
- `file`: The image file (JPG/PNG).
- `width`: Target width in pixels (e.g., 600).
- `height`: Target height in pixels (e.g., 600).
**Response:**
- Returns a binary JPEG stream of the processed image.
**Concurrency:**
- The server implements a **Global Lock**.
- Only **1 request** is processed at a time.
- Subsequent requests will wait in a queue until the lock is released.
## Architecture
- **Frontend:** Next.js (React) on Port 3000.
- Components: `src/components/VisaPhotoMaker.tsx` (Core Logic).
- Routes: `src/app/[lang]/page.tsx`.
- **Backend:** FastAPI (Python) on Port 13002.
- **Process Management:** PM2.
## Deployment
Managed via PM2:
```bash
pm2 list
pm2 restart visa-backend
pm2 restart visa-frontend
``` |