Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Last active June 25, 2021 02:12
Show Gist options
  • Save piscisaureus/712aaff5436be6fa1a32a0e63c960c37 to your computer and use it in GitHub Desktop.
Save piscisaureus/712aaff5436be6fa1a32a0e63c960c37 to your computer and use it in GitHub Desktop.
deno icons
#!/bin/sh
# This script generates multi-size .ico files from the highly stylized "simple"
# Deno logos, designed by HashRock.
# The complication stems from the fact the the dimensions of the original .png
# files is 252x252 pixels. Naively rescaling these images to 256x256 or any
# other power of 2 produces ugly artifacts.
# Note that the output of the black-and-white logo transformation isn't
# entirely artifact-free because the source image has some glitches already.
# ImageMagick must be installed and available in $PATH to run this script.
# It was written for imagemagick 7.x, but version 6.x probably works too.
convert \
-size 256x256 \
\( xc:transparent -fill black -draw "circle 127.5,127.5 127.5,0.1" \) \
\( ./bw.png -repage +2+2 \) \
-background transparent -compose src-over -flatten \
+repage -depth 8 \
-define icon:auto-resize="256,128,96,64,48,40,32,24,20,16" -compress zip \
bw.ico
convert \
-size 256x256 \
\( xc:transparent -fill white -draw "circle 127.5,127.5 127.5,0.1" \) \
\( ./color.png -repage +2+2 \) \
-background transparent -compose src-over -flatten \
+repage -depth 8 \
-define icon:auto-resize="256,128,96,64,48,40,32,24,20,16" -compress zip \
color.ico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment