Generating Favicons using ImageMagick on the Command-Line
Last week I took a new profile photo, and as such I needed to update my favicon so it would match the new look.
As it's something I very infrequently do, I would usually reach for an online tool to do this, but I wanted to see if I could use the ever handy ImageMagick to do this for me, especially as it's good to not rely on online tools.
Following this (slightly rude) reply, we can see that we can run the following command to produce a .ico
file, with all the relevant sizes, in a single file:
convert profile.png -bordercolor white -border 0 \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
-delete 0 -alpha off -colors 256 favicon.ico