Skip to content

Repository files navigation

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

About

Python library designed to sanitize images by removing sensitive metadata

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages