Last active
April 11, 2024 19:25
-
-
Save Lerg/b0a643a13f751747976f to your computer and use it in GitHub Desktop.
Make all app icons with imagemagick, iOS and Android
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 | |
base=$1 | |
convert "$base" -resize '29x29' -unsharp 1x4 "Icon-Small.png" | |
convert "$base" -resize '40x40' -unsharp 1x4 "Icon-Small-40.png" | |
convert "$base" -resize '50x50' -unsharp 1x4 "Icon-Small-50.png" | |
convert "$base" -resize '57x57' -unsharp 1x4 "Icon.png" | |
convert "$base" -resize '58x58' -unsharp 1x4 "[email protected]" | |
convert "$base" -resize '60x60' -unsharp 1x4 "Icon-60.png" | |
convert "$base" -resize '72x72' -unsharp 1x4 "Icon-72.png" | |
convert "$base" -resize '76x76' -unsharp 1x4 "Icon-76.png" | |
convert "$base" -resize '80x80' -unsharp 1x4 "[email protected]" | |
convert "$base" -resize '100x100' -unsharp 1x4 "[email protected]" | |
convert "$base" -resize '114x114' -unsharp 1x4 "[email protected]" | |
convert "$base" -resize '120x120' -unsharp 1x4 "[email protected]" | |
convert "$base" -resize '144x144' -unsharp 1x4 "[email protected]" | |
convert "$base" -resize '152x152' -unsharp 1x4 "[email protected]" | |
convert "$base" -resize '180x180' -unsharp 1x4 "[email protected]" | |
convert "$base" -resize '512x512' -unsharp 1x4 "iTunesArtwork" | |
convert "$base" -resize '1024x1024' -unsharp 1x4 "iTunesArtwork@2x" | |
convert "$base" -resize '36x36' -unsharp 1x4 "Icon-ldpi.png" | |
convert "$base" -resize '48x48' -unsharp 1x4 "Icon-mdpi.png" | |
convert "$base" -resize '72x72' -unsharp 1x4 "Icon-hdpi.png" | |
convert "$base" -resize '96x96' -unsharp 1x4 "Icon-xhdpi.png" | |
convert "$base" -resize '144x144' -unsharp 1x4 "Icon-xxhdpi.png" | |
convert "$base" -resize '192x192' -unsharp 1x4 "Icon-xxxhdpi.png" |
For iOS 10 message extension icons.
#!/bin/sh
base=$1
if [ -z $base ]
then
echo No argument given
else
##
## iOS files
convert "$base" -resize 148x110! "[email protected]"
convert "$base" -resize 134x100! "[email protected]"
convert "$base" -resize 120x90! "[email protected]"
convert "$base" -resize 180x135! "[email protected]"
convert "$base" -resize 54x40! "[email protected]"
convert "$base" -resize 81x60! "[email protected]"
convert "$base" -resize 64x48! "[email protected]"
convert "$base" -resize 96x72! "[email protected]"
convert "$base" -resize 1024x768! "Messages-AppStore.png"
fi
For other people coming here, some of the above follow-up scripts input the POINTS values for sizes rather than PIXEL and thus need to be doubled.
#!/bin/sh
sizes="20x1 20x2 20x3 29x1 29x2 29x3 40x1 40x2 40x3 60x2 60x3 76x1 76x2 83.5x2 1024x1"
source=${1:-logo.svg}
dst=${2:-.}
for s in $sizes;do
size=${s%x*}
scale=${s##*x}
resize=$(bc <<< ${size}*${scale} )
convert "$source" -resize ${resize}x${resize} -unsharp 1x4 $dst/"Icon-App-${size}x${size}@${scale}x.png"
done
Added some new sizes, to be used with Zabbix Monitor.
#!/usr/bin/env bash
#
__imgSource=${1:-icon.png}
__imgDest=${__imgSource%.*}
__imgRepository=${2:-Icons}
#
[ -f ${__imgSource} ] || exit 0
[ -d ${__imgRepository} ] || mkdir -p ${__imgRepository}
#
__imgSize=(
"24x1" "48x1" "64x1" "96x1" "128x1"
"20x1" "20x2" "20x3"
"29x1" "29x2" "29x3"
"40x1" "40x2" "40x3"
"60x2" "60x3"
"76x1" "76x2"
"83.5x2" "1024x1"
)
#
for eSize in ${__imgSize[*]}; do
size=${eSize%x*}
scale=${eSize##*x}
resize=$(bc <<< ${size}*${scale} )
echo "resizing ${__imgSource} to ${size}x${size}@${scale}"
convert ${__imgSource} \
-resize ${resize}x${resize} \
-unsharp '1.5x1+0.7+0.02' \
${__imgRepository}/Icon-${__imgDest}-${size}x${size}@${scale}x.png
done
FWIW, I made a fork with the apple watch icon sizes here: https://gist.github.com/mgrider/3c25a49accf46f8953e7d4dc49fca2c1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added a couple of new sizes in there (83.5 and icon-small@3x)