Skip to content

Instantly share code, notes, and snippets.

@LockeBirdsey
Created February 2, 2020 11:57
Show Gist options
  • Save LockeBirdsey/e4a311b8c3563a8620b977a94042af87 to your computer and use it in GitHub Desktop.
Save LockeBirdsey/e4a311b8c3563a8620b977a94042af87 to your computer and use it in GitHub Desktop.
Converts a PNG to a Windows ICO file. Uses imagemagick instead of sips for conversion for nix-ness
#!/bin/bash
#The image you want to make into a Windows ICO file
#Requires imagemagick
orig=$1
mkdir tmp_ico_dir
# resize all the images
convert -scale 16 $orig tmp_ico_dir/icon_16x16.png
convert -scale 32 $orig tmp_ico_dir/icon_32x32.png
convert -scale 128 $orig tmp_ico_dir/icon_128x128.png
convert -scale 256 $orig tmp_ico_dir/icon_256x256.png
convert -scale 512 $orig tmp_ico_dir/icon_512x512.png
#convert -scale 1024 $orig tmp_ico_dir/icon_1024x1024.png
# create the .ico
convert tmp_ico_dir/*.png icon.ico
# remove the temp folder
rm -R tmp_ico_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment