Image optimiser
A script that resizes website images to their on-page max resolution — born from the FC site that launched one hundred times too heavy.
The image optimiser is live and available to download. The tool is ready to use; it currently does not have a GUI, which may come later.
It was born out of a very practical need: optimising images. When I built the FC website I took the best-resolution screenshots of our in-game characters I could. I neglected to optimise any of them and did not care much at the time — I wanted the site online quickly, share the excitement, and let people play the easter egg game I was building. V1.0 launched with a page weight probably a hundred times what it should have been, and it made my internet connection look like a dial-up modem.
There was no way I was going to manually rescale every image; I had other work to do. So I wrote a script to resize them automatically, based on the maximum resolution each image is actually used at on the site.
Additional info
Highlights
- Born from the FC site launch — full-res assets online, then a hundred-fold weight problem to fix.
- Runs on any web project; specifically tuned for Alterna design-kit components.
- Automatic resize to each image's max on-site resolution; run before build.
- Prebuilt download is Linux-only; macOS and Windows builds from the GitLab source.
- Configurable paths; optional removal or relocation of unused and original files.
What started as a quick, dirty script became handy enough to clean up properly: a Python tool that resizes images to their used size on the website. It is not the most exciting project, but it has proved very useful — I keep the nice originals for local work, run the script before shipping, and avoid disgustingly large pages that feel like you have 90s internet.
The script is available for download and can be run from the root folder of any web project, though it is specifically optimised to work with Alterna design-kit components. It can be configured for different directories or limited to certain paths only. It can also remove unused images and original files, or copy unused and original files to a location you choose.
The prebuilt download is Linux-only — that is what I run on every machine at home. macOS and Windows builds should be straightforward from the source on GitLab if you need them there.