Last active
April 28, 2022 18:30
-
-
Save donnywals/3be3774435cf53133ee7f8c553e9c080 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# make sure you have imagemagick installed: brew install imagemagick | |
# your app_icons.sh file should have the correct permissions: run `chmod 775 app_icons.sh` in your terminal from where you put this file | |
# put your `my_icon.png` next to this file and run ./app_icons.sh to export your app icons | |
x=my_icon.png | |
y=${x%.*} | |
# delete the export directory so we start clean | |
rm -r converted/$y | |
# create a fresh export firectory | |
mkdir converted/$y | |
# export all images | |
convert $x -resize 20x20 converted/$y/[email protected] | |
convert $x -resize 40x40 converted/$y/[email protected] | |
convert $x -resize 60x60 converted/$y/[email protected] | |
convert $x -resize 29x29 converted/$y/[email protected] | |
convert $x -resize 58x58 converted/$y/[email protected] | |
convert $x -resize 87x87 converted/$y/[email protected] | |
convert $x -resize 40x40 converted/$y/[email protected] | |
convert $x -resize 80x80 converted/$y/[email protected] | |
convert $x -resize 120x120 converted/$y/[email protected] | |
convert $x -resize 60x60 converted/$y/[email protected] | |
convert $x -resize 120x120 converted/$y/[email protected] | |
convert $x -resize 180x180 converted/$y/[email protected] | |
convert $x -resize 76x76 converted/$y/[email protected] | |
convert $x -resize 152x152 converted/$y/[email protected] | |
convert $x -resize 228x228 converted/$y/[email protected] | |
convert $x -resize 167x167 converted/$y/[email protected] | |
# copy input file as the 1024x1024 icon | |
cp $x converted/$y/[email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Attached is the same but with a for loop and allows the script to take the filename as an argument instead of it expecting it to be my_icon.png
I tried quickly getting it to work with svg/pdf's but ImageMagick has issues doing this conversion in an easy way for us since it wants the density parameter. inkscape seems to do a good job but would require installation as I don't believe its normally bundled in the system.