A python wrapper to provide a pip-installable jpegoptim binary.
Internally this package provides a convenient way to download the pre-built jpegoptim binary for your particular platform.
pip install jpegoptim-py
After installation, the jpegoptim
binary should be available in your
environment (or jpegoptim.exe
on windows).
See pre-commit for instructions
Sample .pre-commit-config.yaml
:
- repo: https://github.com/UnknownPlatypus/jpegoptim-py
rev: v1.5.5.2
hooks:
- id: jpegoptim
Lossy compression is not idempotent. In that case, consider adding a threshold, otherwise you might block the commit for too long.
Sample .pre-commit-config.yaml
with lossy compression enabled:
- repo: https://github.com/UnknownPlatypus/jpegoptim-py
rev: v1.5.5.2
hooks:
- id: jpegoptim
args: [--strip-all, --all-progressive, --max=85, --threshold=3]
This is an adaptation of shellcheck-py following the exact same strategy. This aims at making it easier to use as a pre-commit hook.