Metadata-Version: 2.4
Name: aadhaar-masking
Version: 0.1.2
Summary: A high-performance library for masking Aadhaar numbers in images and multi-page PDFs with C++ multi-threading support.
Home-page: https://github.com/Sohan-2001/Leasds-Aakash
Author: Aakash Leads
Author-email: Aakash Leads <developer@example.com>
License: MIT
Project-URL: Homepage, https://github.com/Sohan-2001/Leasds-Aakash
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: C++
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: opencv-python>=4.5.0
Requires-Dist: numpy>=1.20.0
Requires-Dist: rapidocr-onnxruntime>=1.3.0
Requires-Dist: PyMuPDF>=1.20.0
Requires-Dist: Pillow>=9.0.0
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# Aadhaar Masking Engine (`aadhaar-masking`)

[![PyPI Version](https://img.shields.io/pypi/v/aadhaar-masking.svg)](https://pypi.org/project/aadhaar-masking/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/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

```bash
pip install aadhaar-masking
```

---

## Quick Start Usage

### Python API

```python
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)

```bash
# 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.
