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.2.tar.gz (14.1 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.2-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: img_sanitizer-0.1.2.tar.gz
  • Upload date:
  • Size: 14.1 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.2.tar.gz
Algorithm Hash digest
SHA256 cd6feea04d6a85f49db20ce40fc2abbe8400c1a7cf9adf93cd342b69bd75dbbc
MD5 495ce6935cdc42bb32673fa355a038ed
BLAKE2b-256 a33dd0d17bc3db0a08e2911fe0a37a150adc4b908b848e31ffccdf234da4b382

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_sanitizer-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: img_sanitizer-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 38fcaccb13dcf3bdc9dd91daaa6af7afb5d4d5b4a8f9f7766921bbc2e77cb82b
MD5 81c2fcd5bba5d2304ec7ed199fa843e8
BLAKE2b-256 cf55158da7ad3f6ddd603f652b2f9859f422ab69e77e08bc2e1e7dd97d07e9c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_sanitizer-0.1.2-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