opensourceprojects.dev

A broadsheet for software that doesn't ask for your email

HivisionIDPhoto: an open-source tool for making ID photos with AI
GitHub RepoImpressions6

Project Description

View on GitHub

HivisionIDPhoto: An Open-Source AI Tool That Turns Any Photo Into an ID Photo

You know the drill. You need a passport photo or a professional headshot, but you don't have time to visit a studio, and the drugstore photo booth is closed. You end up taking a selfie against a white wall, hoping the lighting and crop will pass inspection. It usually doesn't. HivisionIDPhoto is an open-source project that solves this exact problem with a practical AI pipeline that handles background removal, resizing, and layout generation for standard ID photos. It runs offline on just a CPU, which means you don't need a GPU or an internet connection to get usable results.

What It Does

HivisionIDPhoto is a complete system for making ID photos using AI. It takes a regular photo of a person and processes it through a series of models to produce a finished ID photo that meets specific size and format requirements. The core workflow covers background removal, face alignment, and generation of standard photo sizes including the common one-inch and two-inch formats used in China, as well as American-style ID photos.

The project uses a lightweight matting model that runs entirely offline and can infer on CPU alone. This is not a cloud-dependent service—you can run it on your own machine with no internet required. The system also supports a hybrid "end-cloud" mode if you want to offload processing, but the offline default is the focus here. Beyond basic background replacement, HivisionIDPhoto includes face rotation and alignment, beautification features, and the ability to generate print-ready layout sheets for common paper sizes like six-inch, five-inch, A4, 3R, and 4R. The output supports 300 DPI for high-quality printing.

The project is written in Python and uses Gradio for its demo interface. It also provides a REST API for integration into other applications. There are community-built extensions for ComfyUI, WeChat mini-programs, and a C++ port, which shows the project has some flexibility beyond its core Python implementation.

Why It's Cool

The most interesting thing about HivisionIDPhoto is that it treats ID photo generation as a practical engineering problem rather than a research demo. Here is what stands out:

  • CPU-only inference is the default. Most AI image tools demand a GPU. This one works on a laptop with no dedicated graphics card. That is a real differentiator for a tool that you might need to run in a hurry on whatever machine is available.

  • The print layout feature is genuinely useful. The project includes options to generate layout sheets for standard photo paper sizes. That means you can produce a sheet of multiple ID photos ready to cut, just like the prints from a photo booth. This is the kind of detail that makes a tool feel complete rather than half-baked.

  • Continuous updates add real functionality. The changelog shows a steady stream of practical additions: millimeter-based custom size input, hex color input for custom backgrounds, JPEG download options, and a "beast mode" for memory management. These are not vanity features—they solve real friction points when you are trying to produce a usable photo.

  • The community has already built integrations. ComfyUI workflows, WeChat mini-programs, and a C++ port exist. That suggests the API is straightforward enough to wrap, and the project has enough utility that people want to embed it in their own tools.

  • Beautification and face alignment are included. These are not afterthoughts. The face alignment feature rotates and centers the face automatically, which is critical for meeting official ID photo standards. The beautification option is a nice bonus if you need it.

How to Try It

The fastest way to test HivisionIDPhoto is through one of the hosted demos. You can try it on Hugging Face Spaces or through the ModelScope and SwanHub links listed in the README. These let you upload a photo and see the results without installing anything.

If you want to run it locally, clone the repository and install the dependencies. The README provides commands for setting up the environment and launching the Gradio demo:

git clone https://github.com/Zeyi-Lin/HivisionIDPhotos
cd HivisionIDPhotos
pip install -r requirements.txt
python app.py

This starts a local web interface where you can upload images, choose background colors, set output sizes, and download the results. There is also a Python API if you want to integrate the functionality into your own scripts. The Docker deployment option is documented for containerized setups.

Check the repository at github.com/Zeyi-Lin/HivisionIDPhotos for the full README, including API documentation and deployment instructions.

Final Thoughts

HivisionIDPhoto is a well-scoped tool that solves a specific, annoying problem without overcomplicating it. It is best for anyone who needs to produce ID photos regularly—administrators, HR staff, students, or developers who want to embed photo processing into a kiosk or web app. The CPU-only requirement and print layout support make it genuinely practical. The project is actively maintained, the community is building on it, and the code is straightforward enough to understand and modify. If you have ever wasted time trying to crop and resize a photo to meet government specifications, this is worth a look.

Follow @githubprojects for more developer tools and open source projects.

Back to Projects
Project ID: 1027a7a8-2109-4ea7-b3b1-f84fe548591aLast updated: July 17, 2026 at 02:44 AM