Skip to content

Instantly share code, notes, and snippets.

@Lerg
Last active April 11, 2024 19:25
Show Gist options
  • Save Lerg/b0a643a13f751747976f to your computer and use it in GitHub Desktop.
Save Lerg/b0a643a13f751747976f to your computer and use it in GitHub Desktop.
Make all app icons with imagemagick, iOS and Android
#!/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"
@andresaquino
Copy link

andresaquino commented Jan 27, 2019

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

@mgrider
Copy link

mgrider commented Jul 26, 2019

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