Skip to main content

Python library designed to prepare, clean, and normalize JPEG images before publishing or archiving.

Project description

img-sanitizer



Python library designed to sanitize images by removing sensitive metadata.

Features

  • CLI tool to scan and sanitize images.
  • Generates simple reports about findings.
  • Designed to be used in scripts or as a developer tool.

Installation

Install from PyPI with:

pip install img-sanitizer

Or install from source in an editable virtual environment:

git clone https://github.com/6C656C65/img-sanitizer.git
cd img-sanitizer
python -m venv .venv
source .venv/bin/activate
pip install -e .

Usage

After installation the CLI command is img-sanitizer.

Sanitize a source directory (or files) and write sanitized images to a destination directory:

img-sanitizer sanitize SOURCE DESTINATION --worker 4
  • SOURCE: a directory containing images (or a file path).
  • DESTINATION: directory where sanitized images will be written.
  • --worker: number of worker threads (default: 4).

Global flags:

  • --debug: enable debug logging for more verbose output (global).

Other commands:

  • img-sanitizer version: print the installed package version.

Check --help for subcommand and flag details:

img-sanitizer --help
img-sanitizer sanitize --help

How it works

The project provides a small Python package (img_sanitizer) with a CLI entrypoint.

  • sanitizer.py contains the core logic to inspect and sanitize image files.
  • report.py builds a human-readable report from the sanitizer's findings.
  • cli.py wires the command-line interface to the sanitizer and report generators.

Typical processing flow:

  1. CLI parses command-line arguments and file paths.
  2. The sanitizer opens each image, inspects metadata and content heuristics.
  3. Any sensitive items are removed (when requested) or recorded in a report.
  4. The report is printed to stdout or written to a file.

The tool is intentionally small and focused; it does not try to be a comprehensive forensic solution.

Testing

The project includes unit tests (in the tests/ directory). Run them with pytest:

pytest -q

Contributing

Contributions are welcome. Please open issues for bugs or feature requests and submit PRs with tests.

License

See the repository LICENSE for license details.# img-sanitizer

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

img_sanitizer-0.1.3.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

img_sanitizer-0.1.3-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file img_sanitizer-0.1.3.tar.gz.

File metadata

  • Download URL: img_sanitizer-0.1.3.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for img_sanitizer-0.1.3.tar.gz
Algorithm Hash digest
SHA256 22c498799f881b7ec21793658aef2c4df5c10e3841d21cda81f6123c83ebfbe0
MD5 17baa6be0217fb0eb6f0498557be1cc6
BLAKE2b-256 4c42a97d613ad89874cbdaf67b64d97833c5be3d4e906f95d0447427af1c4636

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_sanitizer-0.1.3.tar.gz:

Publisher: main.yml on 6C656C65/img-sanitizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_sanitizer-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: img_sanitizer-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for img_sanitizer-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4f0be530d1fdf17a4d5a88f49dd2ebc781d1827893de00721c5813637c336e78
MD5 0f2cde240dc7c30e2ca359d89413eae4
BLAKE2b-256 e244d383cdc54b5d4fa8d629d0db696963b3b2a9e97160968e7513131bb4e0d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_sanitizer-0.1.3-py3-none-any.whl:

Publisher: main.yml on 6C656C65/img-sanitizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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