Automate thumbnails generation

In my latest post I told you I was starting a video series on Kubernetes and its ecosystem.

As part of the process, I uploaded all the streams on Youtube. I uploaded the first video without thinking it through. Still, for the second, I decided that it would be good to have a thumbnail for the video, and why would I do it manually if there is a way to automate it?

I first designed the thumbnail using Inkscape and saved it as thumbnail.svg, the output is the image below:

thumbnail.svg

The rest is simple; the SVG format is just text, so every time I want to generate a new thumbnail, I can run:

export TOPIC=kubectl;
sed "s/topic/$TOPIC/" thumbnail.svg | convert -size 2560x1440 svg:- "$TOPIC.png"

To get:

kubectl.png

This process will also help if I change the template slightly and want to regenerate the thumbnails for all the videos.