The folks at Calibre have release a GitHub Action named “Image Actions” and I must say, it looks amazing insane:
Image actions will automatically compress jpeg and png images in GitHub Pull Requests.
- Compression is fast, efficient and lossless
- Uses mozjpeg + libvips, the best image compression available
- Runs in GitHub Actions, so it’s visible to everyone
Never ship unoptimised graphics again!
Once the workflow is added to your repo, Compression levels and source paths exclusions can easily be configured using a .github/calibre/image-actions.yml
file:
jpeg:
quality: 80
png:
quality: 80
ignorePaths:
- "node_modules/**"
Calibre Blog: Automatically compress images on Pull Requests →
GitHub Actions Marketplace: Image actions →
🤔 In case you’re wondering why you should compress your images be sure to read Addy Osmani’s free ebook “Essential Image Optimization”