Adding Image Optimization to My Static Site Generator

Written By: Jake Bauer | Posted: 2020-08-06 | Last Updated: 2020-08-06

I just added image optimization and resizing to my website’s static site generator so that uploading images to my website involves a lot less manual labour.

For a while I’ve been using to optimize the PNG, JPG, and JPEG images that I upload to my website since I found that it did a better job than the command line utility pngquant (which also only worked on PNGs). They have an API service which allows one to upload 500 images in a month for free which is much more convenient than visiting the website every time I need to optimize an image. Using the magic of curl, I added the ability to use this API from my compile script which also handles compiling Markdown to HTML and CSS minification.

Another thing I added to the script was a -r or --resize option which takes a number (let’s call it x) as an argument and uses the convert utility from ImageMagick to resize the input image by x%. I would commonly do this on the command line to generate smaller images (thumbnails, sort of) for embedding in blog posts to make page load sizes smaller so including it in the script alongside image optimization was a no-brainer.

I am slowly getting closer to releasing my scripts as a standalone project. It would be a set of static site generator scripts that anybody could use but without the bloat and complication of the existing ones such as Hugo or Jekyll. I’m aiming for it to be a static site generator for minimalists who don’t want to go through the hassle of writing their own, plus I want to include HTML to Gopher/Gemini conversion scripts.

This is my eighty-sixth post for the #100DaysToOffload challenge. You can learn more about this challenge over at