Day 2: Optimizing Images
December 02, 2019
When adding images into projects, they sometimes include a lot of metadata or are saved in formats that have large file sizes by default. The folks over at Calibre created an action called image-actions which provides a way to automatically compress JPGs, PNGs, and WebP images.
Example Usage
As in their example, a use case is to optimize images in Pull Requests:
name: Compress imageson: pull_requestjobs:build:name: calibreapp/image-actionsruns-on: ubuntu-lateststeps:- uses: actions/checkout@master- name: calibreapp/image-actionsuses: docker://calibreapp/github-image-actionsenv:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
so then if you had this in a project and created a PR that added some images, it would optimize them, make a new commit to the PR, and then add a comment saying which ones were compressed.