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.1.tar.gz (13.6 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.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: img_sanitizer-0.1.1.tar.gz
  • Upload date:
  • Size: 13.6 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.1.tar.gz
Algorithm Hash digest
SHA256 266413c10654ced4bed8e4fdef731d5dac326ff3c31966aa67df76dd3f23a41f
MD5 bd96a8a9e529423ce872ec56f5a3bcba
BLAKE2b-256 e0e8a29f8e069f056b360a7dac2515db6f0f117f8e64dcce628cfa494bc612b7

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: img_sanitizer-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aecbc18a3e5b2300fb4194ed7f4e7076a6b85d831adfe7897bb07605450e10bb
MD5 07c7d5e5d362fdb2a7e8900cbd16f3d8
BLAKE2b-256 e253b39a61ed615e12f96dafabd7c4294172e7058d2a4c557917c6d792e96d3f

See more details on using hashes here.

Provenance

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