← all repositories
Zeyi-Lin/HivisionIDPhotos

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.

HivisionIDPhotos
Velocity · 7d
+19
★ / day
Trend
steady
star history

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.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.