Building a Browser-Based ID Photo Maker: Face Detection, Head Estimation & Background Removal A developer built a fully client-side ID photo maker using a three-tier face detection chain (MediaPipe, Browser FaceDetector, BlazeFace) with anthropometric head measurement and background removal. The solution runs entirely in the browser, avoiding server costs and enabling instant preview. The browser has become a surprisingly capable platform for computer vision. In this post, I'll walk through building a fully client-side ID photo maker — covering multi-tier face detection, anthropometric head measurement, segmentation-refined cropping, and background removal with color decontamination. ID photos have strict requirements: head height ratios, eye-line positions, margin rules. Tools like HivisionIDPhotos https://github.com/Zeyi-Lin/HivisionIDPhotos , dpar39/ppp https://github.com/dpar39/ppp , and commercial services like dreamega.ai https://dreamega.ai and photoaid.com https://photoaid.com all need to solve the same core problem: given an uploaded portrait, detect the face accurately enough to auto-crop to spec. Server-side tools can afford heavyweight models HivisionIDPhotos uses ONNX runtime with dedicated face parsing networks . But if you want to run everything client-side — no upload, no server cost, instant preview — the browser environment is unpredictable. Not every user has Chrome's experimental FaceDetector API, and WebGL support varies. Our solution: a three-tier detection chain that tries the best option first and gracefully falls back. // Detection chain: MediaPipe 478 landmarks → Browser FaceDetector → BlazeFace export async function detectFace image: HTMLImageElement : Promise