Skip to main content

Aadhaar Masking Engine (aadhaar-masking)

PyPI Version License: MIT

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 pybind11 when a C++ compiler is available.
    • Automatically falls back to Python ThreadPoolExecutor when C++ binary extension is unavailable.
  • 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.

Metadata

Release files for aadhaar-masking 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aadhaar-masking 0.1.3
File Size Uploaded Provenance Actions
aadhaar_masking-0.1.3.tar.gz 10.4 kB Without provenance Details for aadhaar_masking-0.1.3.tar.gz

Release files / aadhaar_masking-0.1.3.tar.gz

Download URL aadhaar_masking-0.1.3.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
00b7bde7fdd89d594144296462d50c3f66a2e4658ff6b47212779679ae264448
BLAKE2b-256 checksum
How to use checksums
5650036c17ea1985369c6bd7096a520dca96b7310944e06225bcd5547f85d255
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for aadhaar-masking 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page