Compress Your Images in GitHub with Image Actions 2.0

Karolina Szczur

Karolina Szczur

October 15, 2020

A year ago, we released Image Actions, a GitHub Action that automatically optimises images in your pull requests. Since then, it has become one of the most popular actions, helping builders for the web ensure their visuals don’t negatively affect performance and user experience.

Here’s a summary of the most critical changes in Image Actions 2.0.

See the visual difference before and after compression

An example Image Actions comment posted on your Pull Request.

Often, the concern with image optimisation, especially when it’s automated, is a significant quality loss. We now leverage GitHub’s visual diffing so you can ensure the results match your standards. Every compressed image has a link to view a comparison between versions.

Visual comparison of an image compressed with Image Actions

Create complex workflows to match your needs

By default, Image Actions adds optimised images to the current Pull Request and posts a summary comment. The new compressOnly option allows skipping those steps to enable more complex workflows.

For example, compressOnly allows working around the GitHub Actions limitation of not being able to alter pull requests coming from forked repositories. You can combine all of those options in an all-encompassing workflow that will cater to most scenarios. See a code example here.

Run optimisations on a schedule

Sometimes, running optimisations only when a pull request is open might not be enough. Thanks to the new compressOnly mode and additional GitHub Actions (like create-pull-request), you can schedule when optimisations should run. For example, you could schedule an on-demand compression at a selected time, once a week, to make sure no visuals slip through the cracks.

Run Image Actions on Git LFS repositories

If you are using Git Large File Storage (LFS) extension in your repositories, you can now use Image Actions.

Contribute with ease

We have made numerous improvements to the experience of contributing and working with Image Actions.

The project README has been revamped to explain the usage, available configuration options and contributing guidelines better. When creating an issue or pull request, pre-baked templates will ensure we have the necessary details to timely triage problems and merge new releases. Image Actions also now operates under a Code of Conduct, which provides standards for a safe and welcoming space we want to foster.

Lastly, we converted Image Actions to TypeScript. It’s now easier to develop and contribute thanks to type checking and compilation.


We continue working on Image Actions and other open source tools to help the community improve the performance of their projects and products. Image Actions is free, doesn’t require any new registrations outside of an existing GitHub account and has a simple set up. Get started here.

Karolina Szczur

Karolina Szczur

Karolina is a Co-founder and Product Design Lead at Calibre. With years of design experience under her belt, she’s responsible for the comprehensive user experience spanning over product, visuals and content. Find her on Mastodon or LinkedIn.

Become a site speed expert

Join thousands of subscribers keeping up-to-date with web performance news and advice.

The best performance newsletter I’ve come across. Highly recommended.

Addy Osmani

Addy Osmani

Engineering Manager at Google Chrome