Project · Computer Vision

Photo Studio

A passport-photo compliance pipeline. 468 facial landmarks, 25+ rule checks, and country-specific spec sheets for six destinations.

Computer Vision Multi-Country Production MediaPipe

The problem

Passport-photo specifications are tighter than most users realise. Singapore wants 35×45mm with a specific head-to-frame ratio. The US wants 2×2in with a different ratio. Each country has its own list of forbidden things: glasses, smiles, shadows on the face, neutral backgrounds within a specific RGB band.

Most online photo tools either reject silently or accept things they shouldn't. I wanted one that explains what's wrong, in plain language, in real time, and links the user back to the section of the rule that failed.

Architecture

Face mesh
MediaPipe 468-point face mesh runs in the browser. Detects head pose, eye-line, mouth opening, ear visibility, frame coverage. Local-first — the user's photo never leaves the device unless they hit submit.
Segmentation
rembg with u2net model produces a clean person cutout server-side for background analysis — checks the wall behind the subject for compliance (off-white range for SG, plain white for US, no shadows).
Rule engine
25+ named compliance rules, each with a pass/fail result and a human-readable explanation. Country-specific rule packs override defaults.
UX feedback
Each failed check renders as a card with the rule name, what was detected, and the official source link. The user knows exactly what to fix.
Output
Cropped, recoloured, correctly-sized JPEG ready for upload. Dimensions match the destination's spec sheet exactly.

Country support

What gets shipped

468
Facial landmarks
25+
Compliance rules
6
Countries supported
100%
Local face detection

Tech stack

Python FastAPI MediaPipe OpenCV rembg u2net Pillow Vue TypeScript Railway