LiYing: Open-Source AI ID Photo Automation from Tilt Correction to Print Layouts
LiYing is an open-source AI tool that automates studio ID photo workflows, handling tilt correction, background replacement, cropping, and print layouts entirel
Post-processing identification and passport photos in commercial studios has traditionally required repetitive and time-consuming manual work. Photo editors must inspect subject alignment, correct tilted shoulders and head angles, cleanly separate the portrait from the backdrop to replace it with mandatory official colors, crop to exact regulatory specifications, and tile multiple prints onto standard photographic sheets. LiYing is an open-source automation utility designed to streamline this entire studio post-processing workflow using computer vision and deep learning models.

Image source: @fhwofjow51260 / LiYing (aoguai)
Streamlining Manual Studio Workflows with Automated Pipeline Architecture
In standard portrait studios, converting a raw client snapshot into an official identification photograph often requires skilled operators to manually mask silhouettes, adjust rotation grids, and position alignment guides inside image editing software.
The open-source project LiYing (hosted on GitHub under aoguai/LiYing) was created to eliminate these labor-intensive bottlenecks. Since its introduction, it has gained substantial traction within the open-source and photography communities, accumulating more than 3,300 stars on GitHub.
LiYing consolidates the fragmented steps of portrait retouching into a unified, coherent local workflow. By connecting face and body pose detection, fine portrait matting, and automated print sheet tiling into a single interface, it enables operators to turn a casual studio portrait into an official document-ready photo package with minimal manual intervention.
AI Pose Alignment, Precision Matting, and Standard Dimension Cropping
The core strength of LiYing lies in its dedicated computer vision models that handle precision detection and alignment tasks automatically.
- Automated Shoulder and Face Tilt Correction: Built-in detection models analyze the subject's posture and facial landmarks. When a subject sits slightly off-center or tilts their head during shooting, LiYing calculates the rotational angle and automatically restores a balanced, level, and straight frontal pose.
- Deep-Learning Human Matting and Background Swapping: Rather than relying on simple color thresholding, LiYing employs deep-learning segmentation models that cleanly isolate complex contours and hair boundaries. Once extracted, the background can be replaced instantly with standard solid colors such as white, blue, or red as required by official guidelines.
- Automated Presets for Identification Dimensions: The software includes pre-configured cropping profiles for standard 1-inch photos, 2-inch passport and visa photos, and official examination registration formats, automatically positioning head proportions and margins without requiring manual measurement.
Automated Sheet Tiling, Local Privacy Guarantees, and Practical Caveats
Beyond producing single digital portrait files, LiYing directly addresses commercial print room requirements through built-in layout generation.
The tool provides automated sheet tiling that arranges multiple cropped portraits onto standardized photographic print paper layouts, ready for immediate physical printing. It also includes compressed output handling to ensure that output assets are generated quickly without sacrificing print-level detail.
A decisive architectural advantage of LiYing is that all inference and image editing operations execute completely offline on local hardware. Because customer photographs are never uploaded to remote cloud servers or third-party APIs, studios and privacy-conscious users can deploy the tool without the risk of personal photo data leaks.
Operators should note practical considerations when deploying the software. Running LiYing locally may require configuring Python environments and corresponding deep learning model dependencies. Furthermore, input portraits with low resolution, severe backlighting, or extreme capture angles may experience reduced segmentation precision or alignment accuracy, meaning standard studio lighting and framing practices remain recommended for optimal results.
Sources
- GitHub Repository: aoguai/LiYing
- X (Twitter) Announcement: @fhwofjow51260