Skip to content

Commit

Permalink
docs: add notes on how to use scripts directly
Browse files Browse the repository at this point in the history
  • Loading branch information
boidolr committed May 18, 2024
1 parent d118c58 commit 294cb8b
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ pre-commit-images
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
================

Git hooks to optimize and manipulate images based on the [pre-commit](https://github.com/pre-commit/pre-commit) framework. For supported image formats see the list of available hooks below.
Scripts that can work as `it` hooks to optimize and manipulate images.
These scripts can be called directly or with the provided configration for the [pre-commit](https://github.com/pre-commit/pre-commit) framework.
For details see below.


## Using pre-commit-images with pre-commit

Expand All @@ -19,7 +22,7 @@ Add this to your `.pre-commit-config.yaml`:
```
For an extended example see [`.pre-commit-config.yaml`](.pre-commit-config.yaml).

## Available hooks
### Available hooks

- **`optimize-avif`**: Compress `avif` images.
- `--threshold` can be used to configure which size difference should be used to keep the image.
Expand All @@ -41,6 +44,22 @@ For an extended example see [`.pre-commit-config.yaml`](.pre-commit-config.yaml)
- `--height` new height of images.


## Using scripts directly

Install the package to get access to the scripts defined as command line entry points in [`pyproject.toml`](./pyproject.toml).
The scripts accept the arguments given for the pre-commit hooks. Additionally they exepect to receive the file names to work on.

An example invocation could be `optimize-avif tests/test.avif`.

Available entry points are identical to the pre-commit hooks:
- `optimize-avif`
- `optimize-jpg`
- `optimize-png`
- `optimize-svg`
- `optimize-webp`
- `resize`


## References

These hooks only work because of other projects:
Expand Down

0 comments on commit 294cb8b

Please sign in to comment.