Aadhaar Masking Engine (aadhaar-masking)
A high-performance, color-preserving library for detecting and masking 12-digit Aadhaar card numbers in images (JPG, PNG, TIFF, WEBP) and multi-page PDF documents with C++ multi-threading acceleration and automatic Python ThreadPool fallback.
Features
- Color Preservation: CLAHE red-channel background filtering is used only for text detection. The black masking box is applied directly to the original image, preserving colors, notebook lines, and ink clarity.
- Multi-Page PDF Processing: Automatically splits multi-page PDFs, masks pages containing valid 12-digit Aadhaar numbers (with Verhoeff checksum validation), and recombines them into a single PDF.
- Hybrid Multi-Threading Engine:
- Uses native C++ std::thread execution pool via
pybind11when a C++ compiler is available. - Automatically falls back to Python ThreadPoolExecutor when C++ binary extension is unavailable.
- Uses native C++ std::thread execution pool via
- Temporary File Cleanup: Intermediate OCR preprocessed files are cleaned up immediately after coordinate extraction.
Installation
pip install aadhaar-masking
Quick Start Usage
Python API
from aadhaar_masking import mask_aadhaar
# Mask an image file (JPG, PNG, TIFF, etc.)
mask_aadhaar("input_aadhaar.jpg", "masked_aadhaar.jpg")
# Mask a multi-page PDF document
mask_aadhaar("input_document.pdf", "masked_document.pdf")
Command Line Interface (CLI)
# Mask an image
aadhaar-masker input.jpg output_masked.jpg
# Mask a multi-page PDF
aadhaar-masker input_document.pdf output_masked_document.pdf
# Specify worker threads
aadhaar-masker input_document.pdf output_masked_document.pdf --threads 8
License
MIT License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aadhaar_masking-0.1.0.tar.gz
(10.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aadhaar_masking-0.1.0.tar.gz.
File metadata
- Download URL: aadhaar_masking-0.1.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b5ce2b2a7584337fbb058514b1f292f5a7fb0d6f5d42fa0199426727c858771
|
|
| MD5 |
5b37ede013099333c8853bd878ec5a20
|
|
| BLAKE2b-256 |
11248f18c28d1ac4a6c1276db319d17f2d9732517acb1f5a26903e40a5cdfdf9
|
File details
Details for the file aadhaar_masking-0.1.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: aadhaar_masking-0.1.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 9.3 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d31b0e0636a2d59ffb7225bcf75940cff9ad5d61a308f966a384b2281ab84fd
|
|
| MD5 |
b3f9e7b77fc8ca8c70b2415058591ff6
|
|
| BLAKE2b-256 |
57cb59b50074143356be0dcbbc3ed5e279c25d356b152337f1394c7509bc7d2d
|