Your passport photo, but make it Python
An open-source toolkit that turns casual selfies into compliant ID photos using offline AI matting and face detection.

What it does HivisionIDPhotos is a Python pipeline for generating standard ID photos from ordinary portraits. It detects faces, removes backgrounds, swaps in compliant colors, and outputs print-ready layouts at specified dimensions — all without calling home to cloud APIs unless you opt in.
The interesting bit The project treats “boring” bureaucracy as a computer vision problem. It bundles multiple matting models (MODNet, BiRefNet, RMBG) and face detectors (MTCNN, RetinaFace) so you can trade speed for precision. The default MODNet + MTCNN combo runs in ~0.2 seconds on CPU using 410MB RAM — faster than most photo booth queues.
Key highlights
- Pure offline inference; CPU-only by default, with optional GPU acceleration for BiRefNet
- Gradio web UI, FastAPI service, and raw Python CLI all included
- Outputs standard ID photos, transparent PNGs, background-colored variants, and print layout sheets (6-inch, 5-inch, A4, etc.)
- Face alignment, beauty filter, and custom HEX background colors supported
- Active community ports: ComfyUI nodes, WeChat mini-programs, Windows GUI, even a C++ rewrite
Caveats
- “Smart clothing swap” is listed as a planned feature but marked “waiting” — not implemented
- GPU acceleration requires ~16GB VRAM and manual CUDA/cuDNN setup; only BiRefNet benefits
- Higher-precision matting (BiRefNet + RetinaFace) jumps from sub-second to ~7 seconds and 6GB+ memory
Verdict Worth a look if you build photo kiosks, HR onboarding tools, or just hate drugstore photo lines. Skip if you need the clothing-swap feature today or expect one-click GPU setup.
Frequently asked
- What is Zeyi-Lin/HivisionIDPhotos?
- An open-source toolkit that turns casual selfies into compliant ID photos using offline AI matting and face detection.
- Is HivisionIDPhotos open source?
- Yes — Zeyi-Lin/HivisionIDPhotos is open source, released under the Apache-2.0 license.
- What language is HivisionIDPhotos written in?
- Zeyi-Lin/HivisionIDPhotos is primarily written in Python.
- How popular is HivisionIDPhotos?
- Zeyi-Lin/HivisionIDPhotos has 21.3k stars on GitHub.
- Where can I find HivisionIDPhotos?
- Zeyi-Lin/HivisionIDPhotos is on GitHub at https://github.com/Zeyi-Lin/HivisionIDPhotos.