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.

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.1.tar.gz (10.1 kB view details)

Uploaded Source

File details

Details for the file aadhaar_masking-0.1.1.tar.gz.

File metadata

  • Download URL: aadhaar_masking-0.1.1.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

Hashes for aadhaar_masking-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ea6a2e3cd220a859edc87f1de34d4f5d03ffddb7d8c9c4318d0336ef2ca64eb4
MD5 abaf1f40d0df64c4e2561a7b92596350
BLAKE2b-256 da61a775169e183f718e1b398e0843a5a842668a88e622fa0e6a4791d07349e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page