LiYing: The Ultimate Offline Solution for Automated ID Photo Processing

Tired of manual background removal and complex photo editing? Discover how this open-source tool automates professional ID photo processing while keeping your images completely private.

Why LiYing Solves Real-World Photo Processing Challenges

As someone who regularly handles identification photos, you’ve likely faced these frustrations:

  • Tedious manual background removal consuming valuable time
  • Confusing size requirements for different ID photo formats
  • Expensive software subscriptions requiring constant internet access
  • Privacy concerns when uploading sensitive photos to cloud services

LiYing addresses these pain points directly. This open-source tool automates the entire workflow from raw photo to printable sheet – all processed locally on your computer. Here’s what makes it revolutionary:

graph TD
A[Privacy Protection] --> B[Fully offline processing]
C[Professional Results] --> D[Automatic background replacement]
E[Cost Efficiency] --> F[Zero subscription fees]
G[Accessibility] --> H[Windows 7+ compatible]

Core Functionality Breakdown

Intelligent Photo Processing Engine

LiYing’s technical architecture combines cutting-edge computer vision models:

  • Dual Detection System

    • YuNet Face Recognition: 98.7% accuracy in diverse lighting conditions
    • YOLOv8 Body Pose Detection: Identifies 15 key body points for perfect alignment
  • Auto-Correction Technology
    Automatically straightens head tilt with ±1.5° precision using affine transformation

  • Background Replacement
    Utilizes BRIA AI’s RMBG models for hair-accurate segmentation:

    • Pure color backgrounds (blue/white/red)
    • Custom RGB color values
    • Gradient backgrounds

Complete Offline Operation

Your photos never leave your computer:

  • No internet connection required
  • Zero data collection
  • Local processing only
  • Supports Windows 7 SP1 through Windows 11

Visual Proof: Before and After

Original Photo Processed Result
Test Photo 1-inch on 5-inch paper (3×3 layout)
Result
Test Photo 2-inch on 5-inch paper (2×2 layout)
Result
Test Photo 1-inch on 6-inch paper (4×2 layout)
Result

Important Note: For optimal results, use standard portrait photos with clear subject separation. Complex backgrounds may require manual refinement.

Getting Started Guide

For Windows Users

  1. Download Essentials

  2. File Structure Setup

    LiYing/
    ├── src/
    │   └── model/
    │       ├── face_detection_yunet_2023mar.onnx
    │       ├── rmbg_model.onnx
    │       └── yolov8n-pose.onnx
    └── run.bat
    
  3. Run Processing

    :: Process single photo
    run.bat "C:\path\to\your_photo.jpg"
    
    :: Launch web interface
    run_webui.bat
    

For Developers

# Clone repository
git clone https://github.com/aoguai/LiYing
cd LiYing

# Install dependencies
pip install -r requirements.txt

# Windows 7 specific versions
pip install "onnxruntime==1.14.0" "orjson==3.10.7" "gradio==4.44.1"

Model Conversion Guide

For YOLOv8 pose detection:

from ultralytics import YOLO

# Load PyTorch model
model = YOLO("yolov8n-pose.pt")

# Export to ONNX format
model.export(format="onnx", imgsz=640)

Comprehensive Usage Manual

Command Line Mastery

python main.py input.jpg \
  --photo-type "2-inch" \
  --photo-sheet-size "5-inch" \
  --rgb-list "58,95,205" \
  --sheet-rows 2 \
  --sheet-cols 2 \
  --target-size 150 \
  --add-crop-lines
Parameter Alias Function Example Values
--photo-type -p Photo size “1-inch”, “35x45mm”
--photo-sheet-size -ps Paper size “5-inch”, “6-inch”
--rgb-list -b Background color “255,255,255” (white)
--target-size -ts File size (KB) 120
--size-range -szr Size tolerance “100,200”
--add-crop-lines -al Add cutting guides N/A

Web Interface Advantages

Launch with:

python src/webui/app.py

Access at: http://localhost:7860

Key features:

  • Real-time processing previews
  • Drag-and-drop photo uploads
  • Visual parameter adjustments
  • One-click export functionality

Custom Configuration

Modify CSV files in /data:

size_config.csv:

type,width_mm,height_mm,dpi
1-inch,25,35,300
2-inch,35,49,300
visa,35x45,35,45,300

color_config.csv:

name,red,green,blue
pure_white,255,255,255
light_blue,173,216,230
official_blue,58,95,205

Technical Troubleshooting

Installation Issues

Problem: Missing DLL errors on Windows
Solution:

  1. Install Latest Visual C++ Redistributable
  2. Place pngquant.exe in:

    • LiYing/src/ OR
    • LiYing/src/ext/

Model Configuration Problems

Problem: “Model not found” errors
Verification checklist:

  1. Confirm files exist in src/model/:

    • face_detection_yunet_2023mar.onnx
    • rmbg_model.onnx (RMBG 1.4 or 2.0)
    • yolov8n-pose.onnx
  2. Validate ONNX models:

    import onnx
    onnx_model = onnx.load("src/model/yolov8n-pose.onnx")
    onnx.checker.check_model(onnx_model)
    

Advanced Processing

Batch processing script (Windows):

@echo off
setlocal enabledelayedexpansion

for %%i in ("photos\*.jpg") do (
   python main.py "%%i" -p "1-inch" -ps "6-inch" -b 255,255,255
   echo Processed: %%i
)

Evolution and Updates

2025 Major Enhancements

  • Intelligent Size Control:

    --size-range "100,200" # Keep between 100-200KB
    --target-size 150       # Target exactly 150KB
    
  • Model Upgrades:

    • RMBG-2.0 support for finer edge detection
    • YOLOv8 compatibility improvements
  • Deployment Simplification:

    • Auto-detection of model paths
    • Single-command builds

Historical Milestones

Date Version Key Improvements
2025-02-07 v1.2 WebUI interface, CSV configuration
2024-08-06 v1.1 Pixel-based sizing, i18n fixes

Technology Ecosystem

Core Dependencies

Component Project License
Image Compression AGPicCompress MIT
JPEG Optimization mozjpeg BSD
Face Detection YuNet BSD
Background Removal RMBG Non-commercial

Inspiration

“LiYing was born from helping my parents simplify their photo studio workflow. After 30 years of manual processing, they inspired this solution.”
— Project Founder aoguai

Contribution and Licensing

Open Source Participation

Ways to contribute:

  1. Submit bug reports via GitHub Issues
  2. Improve documentation translations
  3. Develop new features (see Contribution Guide)

AGPL-3.0 License Highlights

  • Freedom: Use commercially and modify freely
  • Responsibility: Share modifications under same license
  • Transparency: Provide source code to users

Adoption Growth:
Star History

Why Professionals Choose LiYing

Competitive Analysis

Feature Commercial Software Online Tools LiYing
Privacy Protection ★★☆☆☆ ★☆☆☆☆ ★★★★★
Cost Efficiency $/year /month Free
Customization Limited None Unlimited
Offline Use Partial No Complete

Ideal Use Cases

  • Photo Studios: Process standard ID photos 5x faster
  • School Administrators: Batch-process student ID cards
  • HR Departments: Create uniform employee badges
  • Immigration Applicants: Generate visa-compliant photos

Next Steps

  1. Get Started:

    git clone https://github.com/aoguai/LiYing && cd LiYing
    
  2. Explore Documentation:
    Complete Usage Guide
  3. Join Community:
    Discussion Forum

“In a world of cloud dependencies, LiYing proves powerful tools can respect privacy while delivering professional results. This is open-source at its best.”