Python library designed to sanitize images by removing sensitive metadata.
- CLI tool to scan and sanitize images.
- Generates simple reports about findings.
- Designed to be used in scripts or as a developer tool.
Install from PyPI with:
pip install img-sanitizerOr 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 .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 4SOURCE: 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 --helpThe project provides a small Python package (img_sanitizer) with a CLI entrypoint.
sanitizer.pycontains the core logic to inspect and sanitize image files.report.pybuilds a human-readable report from the sanitizer's findings.cli.pywires the command-line interface to the sanitizer and report generators.
Typical processing flow:
- CLI parses command-line arguments and file paths.
- The sanitizer opens each image, inspects metadata and content heuristics.
- Any sensitive items are removed (when requested) or recorded in a report.
- 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.
The project includes unit tests (in the tests/ directory). Run them with pytest:
pytest -qContributions are welcome. Please open issues for bugs or feature requests and submit PRs with tests.
See the repository LICENSE for license details.# img-sanitizer