Skip to content

Instantly share code, notes, and snippets.

@brutella
Last active August 29, 2023 15:10
Show Gist options
  • Save brutella/0bcd671a9e4f63edc12e to your computer and use it in GitHub Desktop.
Save brutella/0bcd671a9e4f63edc12e to your computer and use it in GitHub Desktop.
Generate iOS, watchOS, and macOS app icons from one image
#! /bin/sh
function print_example() {
echo "Example"
echo " icons ios ~/AppIcon.pdf ~/Icons/"
}
function print_usage() {
echo "Usage"
echo " icons <ios|watch|complication|macos> in-file.pdf (out-dir)"
}
function command_exists() {
if type "$1" >/dev/null 2>&1; then
return 1
else
return 0
fi
}
if command_exists "sips" == 0 ; then
echo "sips tool not found"
exit 1
fi
if [ "$1" = "--help" ] || [ "$1" = "-h" ] ; then
print_usage
exit 0
fi
PLATFORM="$1"
FILE="$2"
if [ -z "$PLATFORM" ] || [ -z "$FILE" ] ; then
echo "Error: missing arguments"
echo ""
print_usage
echo ""
print_example
exit 1
fi
DIR="$3"
if [ -z "$DIR" ] ; then
DIR=$(dirname $FILE)
fi
# Create directory if needed
mkdir -p "$DIR"
if [[ "$PLATFORM" == *"ios"* ]] ; then # iOS
sips -s format png -Z '180' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '29' "${FILE}" --out "${DIR}"/iPadSettings.png
sips -s format png -Z '58' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '58' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '120' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '87' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '40' "${FILE}" --out "${DIR}"/iPadSpotlight.png
sips -s format png -Z '80' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '80' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '120' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '76' "${FILE}" --out "${DIR}"/iPad.png
sips -s format png -Z '152' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '167' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '40' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '60' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '20' "${FILE}" --out "${DIR}"/iPadNotification.png
sips -s format png -Z '40' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '1024' "${FILE}" --out "${DIR}"/AppStoreMarketing.png
# https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_ref-Asset_Catalog_Format/AppIconType.html
contents_json='{"images":[{"size":"20x20","idiom":"iphone","filename":"[email protected]","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"[email protected]","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"[email protected]","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"[email protected]","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"[email protected]","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"[email protected]","scale":"3x"},{"size":"60x60","idiom":"iphone","filename":"[email protected]","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"[email protected]","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"iPadNotification.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"[email protected]","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"iPadSettings.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"[email protected]","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"iPadSpotlight.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"[email protected]","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"iPad.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"[email protected]","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"[email protected]","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"AppStoreMarketing.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}}'
echo $contents_json > "${DIR}"/Contents.json
fi
if [[ "$PLATFORM" == *"watch"* ]] ; then # Apple Watch
sips -s format png -Z '48' "${FILE}" --out "${DIR}"/Watch38mmNotificationCenter.png
sips -s format png -Z '55' "${FILE}" --out "${DIR}"/Watch42mmNotificationCenter.png
sips -s format png -Z '58' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '87' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '80' "${FILE}" --out "${DIR}"/Watch38MM42MMHomeScreen.png
sips -s format png -Z '88' "${FILE}" --out "${DIR}"/Watch40MMHomeScreen.png
sips -s format png -Z '100' "${FILE}" --out "${DIR}"/Watch44MMHomeScreen.png
sips -s format png -Z '172' "${FILE}" --out "${DIR}"/Watch38MMShortLook.png
sips -s format png -Z '196' "${FILE}" --out "${DIR}"/Watch40MM42MMShortLook.png
sips -s format png -Z '216' "${FILE}" --out "${DIR}"/Watch44MMShortLook.png
sips -s format png -Z '1024' "${FILE}" --out "${DIR}"/WatchAppStore.png
# https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_ref-Asset_Catalog_Format/AppIconType.html
contents_json='{"images":[{"size":"24x24","idiom":"watch","scale":"2x","filename":"Watch38mmNotificationCenter.png","role":"notificationCenter","subtype":"38mm"},{"size":"27.5x27.5","idiom":"watch","scale":"2x","filename":"Watch42mmNotificationCenter.png","role":"notificationCenter","subtype":"42mm"},{"size":"29x29","idiom":"watch","filename":"[email protected]","role":"companionSettings","scale":"2x"},{"size":"29x29","idiom":"watch","filename":"[email protected]","role":"companionSettings","scale":"3x"},{"size":"40x40","idiom":"watch","filename":"Watch38MM42MMHomeScreen.png","scale":"2x","role":"appLauncher","subtype":"38mm"},{"size":"44x44","idiom":"watch","scale":"2x","filename":"Watch40MMHomeScreen.png","role":"appLauncher","subtype":"40mm"},{"size":"50x50","idiom":"watch","scale":"2x","filename":"Watch44MMHomeScreen.png","role":"appLauncher","subtype":"44mm"},{"size":"86x86","idiom":"watch","scale":"2x","filename":"Watch38MMShortLook.png","role":"quickLook","subtype":"38mm"},{"size":"98x98","idiom":"watch","scale":"2x","filename":"Watch40MM42MMShortLook.png","role":"quickLook","subtype":"42mm"},{"size":"108x108","idiom":"watch","scale":"2x","filename":"Watch44MMShortLook.png","role":"quickLook","subtype":"44mm"},{"idiom":"watch-marketing","filename":"WatchAppStore.png","size":"1024x1024","scale":"1x"}],"info":{"version":1,"author":"xcode"}}'
echo $contents_json > "${DIR}"/Contents.json
fi
if [[ "$PLATFORM" == *"complication"* ]] ; then # Apple Watch
sips -s format png -Z '32' "${FILE}" --out "${DIR}"/Circular38mm2x.png
sips -s format png -Z '36' "${FILE}" --out "${DIR}"/Circular40mm2x.png
sips -s format png -Z '36' "${FILE}" --out "${DIR}"/Circular42mm2x.png
sips -s format png -Z '40' "${FILE}" --out "${DIR}"/Circular44mm2x.png
sips -s format png -Z '182' "${FILE}" --out "${DIR}"/ExtraLarge38mm2x.png
sips -s format png -Z '203' "${FILE}" --out "${DIR}"/ExtraLarge40mm2x.png
sips -s format png -Z '203' "${FILE}" --out "${DIR}"/ExtraLarge42mm2x.png
sips -s format png -Z '224' "${FILE}" --out "${DIR}"/ExtraLarge44mm2x.png
sips -s format png -Z '84' "${FILE}" --out "${DIR}"/GraphicBezel40mm2x.png
sips -s format png -Z '84' "${FILE}" --out "${DIR}"/GraphicBezel42mm2x.png
sips -s format png -Z '94' "${FILE}" --out "${DIR}"/GraphicBezel44mm2x.png
sips -s format png -Z '84' "${FILE}" --out "${DIR}"/GraphicCircular40mm2x.png
sips -s format png -Z '84' "${FILE}" --out "${DIR}"/GraphicCircular42mm2x.png
sips -s format png -Z '94' "${FILE}" --out "${DIR}"/GraphicCircular44mm2x.png
sips -s format png -Z '40' "${FILE}" --out "${DIR}"/GraphicCorner40mm2x.png
sips -s format png -Z '40' "${FILE}" --out "${DIR}"/GraphicCorner42mm2x.png
sips -s format png -Z '44' "${FILE}" --out "${DIR}"/GraphicCorner44mm2x.png
sips -s format png -Z '52' "${FILE}" --out "${DIR}"/GraphicModular38mm2x.png
sips -s format png -Z '58' "${FILE}" --out "${DIR}"/GraphicModular40mm2x.png
sips -s format png -Z '58' "${FILE}" --out "${DIR}"/GraphicModular42mm2x.png
sips -s format png -Z '64' "${FILE}" --out "${DIR}"/GraphicModular44mm2x.png
sips -s format png -Z '40' "${FILE}" --out "${DIR}"/GraphicUtilitarian38mm2x.png
sips -s format png -Z '44' "${FILE}" --out "${DIR}"/GraphicUtilitarian40mm2x.png
sips -s format png -Z '44' "${FILE}" --out "${DIR}"/GraphicUtilitarian42mm2x.png
sips -s format png -Z '50' "${FILE}" --out "${DIR}"/GraphicUtilitarian44mm2x.png
echo "NOTE: Graphic Extra Large is not generated since that is not rectangular"
fi
if [[ "$PLATFORM" == *"macos"* ]] ; then # macOS
sips -s format png -Z '1024' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '512' "${FILE}" --out "${DIR}"/icon_512x512.png
sips -s format png -Z '512' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '256' "${FILE}" --out "${DIR}"/icon_256x256.png
sips -s format png -Z '256' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '128' "${FILE}" --out "${DIR}"/icon_128x128.png
sips -s format png -Z '64' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '32' "${FILE}" --out "${DIR}"/icon_32x32.png
sips -s format png -Z '32' "${FILE}" --out "${DIR}"/[email protected]
sips -s format png -Z '16' "${FILE}" --out "${DIR}"/icon_16x16.png
fi
@brutella
Copy link
Author

Examples

  • iPhone and iPad icons ios ~/AppIcon.png
  • WatchKit App icons watch ~/AppIcon.png
  • All icons all ~/AppIcon.png

@mihaiserban
Copy link

Same using 'sips' on MacOS X

#! /bin/sh

function print_example() {
    echo "Example"
    echo "  icons ios ~/AppIcon.png ~/Icons/"
}

function print_usage() {
    echo "Usage"
    echo "  icons <ios|watch|all> in-file.png (out-dir)"
}

function command_exists() {
    if type "$1" >/dev/null 2>&1; then
        return 1
    else
        return 0
    fi
}

if command_exists "sips" == 0 ; then
    echo "sips tool not found"
    exit 1
fi

if [ "$1" = "--help" ] || [ "$1" = "-h" ] ; then
    print_usage
    exit 0
fi

PLATFORM="$1"
FILE="$2"
if [ -z "$PLATFORM" ] || [ -z "$FILE" ] ; then
    echo "Error: missing arguments"
    echo ""
    print_usage
    echo ""
    print_example
    exit 1
fi

DIR="$3"
if [ -z "$DIR" ] ; then
    DIR=$(dirname $FILE)
fi

# Create directory if needed
mkdir -p "$DIR"

if [ "$PLATFORM" == "all" ] ; then
    PLATFORM="ios watch"
fi

if [[ "$PLATFORM" == *"ios"* ]] ; then # iOS
    sips -Z '120'   "${FILE}" --out "${DIR}"/iPhone@2x.png
    sips -Z '180'   "${FILE}" --out "${DIR}"/iPhone@3x.png
    sips -Z '29'     "${FILE}" --out "${DIR}"/iPadSettings.png
    sips -Z '58'     "${FILE}" --out "${DIR}"/iPadSettings@2x.png
    sips -Z '58'     "${FILE}" --out "${DIR}"/iPhoneSettings@2x.png
    sips -Z '87'     "${FILE}" --out "${DIR}"/iPhoneSettings@3x.png
    sips -Z '40'     "${FILE}" --out "${DIR}"/iPadSpotlight.png
    sips -Z '80'     "${FILE}" --out "${DIR}"/iPadSpotlight@2x.png
    sips -Z '80'     "${FILE}" --out "${DIR}"/iPhoneSpotlight@2x.png
    sips -Z '120'   "${FILE}" --out "${DIR}"/iPhoneSpotlight@3x.png
    sips -Z '76'     "${FILE}" --out "${DIR}"/iPad.png
    sips -Z '152'   "${FILE}" --out "${DIR}"/iPad@2x.png
fi

if [[ "$PLATFORM" == *"watch"* ]] ; then # Apple Watch
    sips -Z '48' "${FILE}" --out "${DIR}"/Watch38mmNotificationCenter.png
    sips -Z '55'   "${FILE}" --out "${DIR}"/Watch42mmNotificationCenter.png
    sips -Z '58'   "${FILE}" --out "${DIR}"/WatchCompanionSettings@2x.png
    sips -Z '87'   "${FILE}" --out "${DIR}"/WatchCompanionSettings@3x.png
    sips -Z '80'   "${FILE}" --out "${DIR}"/WatchAllHomeScreen.png
    sips -Z '88'   "${FILE}" --out "${DIR}"/WatchLongLook.png
    sips -Z '172' "${FILE}" --out "${DIR}"/Watch38MMShortLook.png
    sips -Z '196' "${FILE}" --out "${DIR}"/Watch42MMShortLook.png
fi

@brutella
Copy link
Author

brutella commented Aug 8, 2019

Generating iOS app icons now includes a Contents.json.

Lets say you have a folder with multiple icons.
You can then creating multiple app icon sets with the following command.

for f in ./*.png; do icons ios $f $(basename -a -s .png "$f").appiconset; done

@himbeles
Copy link

Updated watchOS generator with json file and AppStore Icon.

#! /bin/sh

function print_example() {
    echo "Example"
    echo "  icons ios ~/AppIcon.png ~/Icons/"
}
    
function print_usage() {
    echo "Usage"
    echo "  icons <ios|watch|macos> in-file.png (out-dir)"
}

function command_exists() {
    if type "$1" >/dev/null 2>&1; then
        return 1
    else
        return 0
    fi
}

if command_exists "sips" == 0 ; then
    echo "sips tool not found"
    exit 1
fi

if [ "$1" = "--help" ] || [ "$1" = "-h" ] ; then
    print_usage
    exit 0
fi

PLATFORM="$1"
FILE="$2"
if [ -z "$PLATFORM" ] || [ -z "$FILE" ] ; then
    echo "Error: missing arguments"
    echo ""
    print_usage
    echo ""
    print_example
    exit 1
fi

DIR="$3"
if [ -z "$DIR" ] ; then
    DIR=$(dirname $FILE)
fi

# Create directory if needed
mkdir -p "$DIR"

if [[ "$PLATFORM" == *"ios"* ]] ; then # iOS
    sips -Z '120'  "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '180'  "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '29'   "${FILE}" --out "${DIR}"/iPadSettings.png
    sips -Z '58'   "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '58'   "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '87'   "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '40'   "${FILE}" --out "${DIR}"/iPadSpotlight.png
    sips -Z '80'   "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '80'   "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '120'  "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '76'   "${FILE}" --out "${DIR}"/iPad.png
    sips -Z '152'  "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '167'  "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '40'   "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '60'   "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '20'   "${FILE}" --out "${DIR}"/iPadNotification.png
    sips -Z '40'   "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '1024' "${FILE}" --out "${DIR}"/AppStoreMarketing.png
    
    # https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_ref-Asset_Catalog_Format/AppIconType.html
    contents_json='{"images":[{"size":"20x20","idiom":"iphone","filename":"[email protected]","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"[email protected]","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"[email protected]","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"[email protected]","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"[email protected]","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"[email protected]","scale":"3x"},{"size":"60x60","idiom":"iphone","filename":"[email protected]","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"[email protected]","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"iPadNotification.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"[email protected]","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"iPadSettings.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"[email protected]","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"iPadSpotlight.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"[email protected]","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"iPad.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"[email protected]","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"[email protected]","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"AppStoreMarketing.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}}'
    echo $contents_json > "${DIR}"/Contents.json
fi

if [[ "$PLATFORM" == *"watch"* ]] ; then # Apple Watch
    sips -Z '48'  "${FILE}" --out "${DIR}"/Watch38mmNotificationCenter.png
    sips -Z '55'  "${FILE}" --out "${DIR}"/Watch42mmNotificationCenter.png
    sips -Z '58'  "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '87'  "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '80'  "${FILE}" --out "${DIR}"/Watch38MM42MMHomeScreen.png
    sips -Z '88'  "${FILE}" --out "${DIR}"/Watch40MMHomeScreen.png
    sips -Z '100' "${FILE}" --out "${DIR}"/Watch44MMHomeScreen.png
    sips -Z '172' "${FILE}" --out "${DIR}"/Watch38MMShortLook.png
    sips -Z '196' "${FILE}" --out "${DIR}"/Watch40MM42MMShortLook.png
    sips -Z '216' "${FILE}" --out "${DIR}"/Watch44MMShortLook.png
    sips -Z '1024' "${FILE}" --out "${DIR}"/WatchAppStore.png

    # https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_ref-Asset_Catalog_Format/AppIconType.html
    contents_json='{"images":[{"size":"24x24","idiom":"watch","scale":"2x","filename":"Watch38mmNotificationCenter.png","role":"notificationCenter","subtype":"38mm"},{"size":"27.5x27.5","idiom":"watch","scale":"2x","filename":"Watch42mmNotificationCenter.png","role":"notificationCenter","subtype":"42mm"},{"size":"29x29","idiom":"watch","filename":"[email protected]","role":"companionSettings","scale":"2x"},{"size":"29x29","idiom":"watch","filename":"[email protected]","role":"companionSettings","scale":"3x"},{"size":"40x40","idiom":"watch","filename":"Watch38MM42MMHomeScreen.png","scale":"2x","role":"appLauncher","subtype":"38mm"},{"size":"44x44","idiom":"watch","scale":"2x","filename":"Watch40MMHomeScreen.png","role":"appLauncher","subtype":"40mm"},{"size":"50x50","idiom":"watch","scale":"2x","filename":"Watch44MMHomeScreen.png","role":"appLauncher","subtype":"44mm"},{"size":"86x86","idiom":"watch","scale":"2x","filename":"Watch38MMShortLook.png","role":"quickLook","subtype":"38mm"},{"size":"98x98","idiom":"watch","scale":"2x","filename":"Watch40MM42MMShortLook.png","role":"quickLook","subtype":"42mm"},{"size":"108x108","idiom":"watch","scale":"2x","filename":"Watch44MMShortLook.png","role":"quickLook","subtype":"44mm"},{"idiom":"watch-marketing","filename":"WatchAppStore.png","size":"1024x1024","scale":"1x"}],"info":{"version":1,"author":"xcode"}}'
    echo $contents_json > "${DIR}"/Contents.json
fi

if [[ "$PLATFORM" == *"macos"* ]] ; then # macOS
    sips -Z '1024' "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '512'  "${FILE}" --out "${DIR}"/icon_512x512.png
    sips -Z '512'  "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '256'  "${FILE}" --out "${DIR}"/icon_256x256.png
    sips -Z '256'  "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '128'  "${FILE}" --out "${DIR}"/icon_128x128.png
    sips -Z '64'   "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '32'   "${FILE}" --out "${DIR}"/icon_32x32.png
    sips -Z '32'   "${FILE}" --out "${DIR}"/[email protected]
    sips -Z '16'   "${FILE}" --out "${DIR}"/icon_16x16.png
fi

@bloempot71
Copy link

bloempot71 commented Sep 1, 2020

For watchOS complications:

if [[ "$PLATFORM" == *"complication"* ]] ; then # Apple Watch
    sips -Z '32'  "${FILE}" --out "${DIR}"/Circular38mm2x.png
    sips -Z '36'  "${FILE}" --out "${DIR}"/Circular40mm2x.png
    sips -Z '36'  "${FILE}" --out "${DIR}"/Circular42mm2x.png
    sips -Z '40'  "${FILE}" --out "${DIR}"/Circular44mm2x.png
    sips -Z '182'  "${FILE}" --out "${DIR}"/ExtraLarge38mm2x.png
    sips -Z '203'  "${FILE}" --out "${DIR}"/ExtraLarge40mm2x.png
    sips -Z '203'  "${FILE}" --out "${DIR}"/ExtraLarge42mm2x.png
    sips -Z '224'  "${FILE}" --out "${DIR}"/ExtraLarge44mm2x.png
    sips -Z '84'  "${FILE}" --out "${DIR}"/GraphicBezel40mm2x.png
    sips -Z '84'  "${FILE}" --out "${DIR}"/GraphicBezel42mm2x.png
    sips -Z '94'  "${FILE}" --out "${DIR}"/GraphicBezel44mm2x.png
    sips -Z '84'  "${FILE}" --out "${DIR}"/GraphicCircular40mm2x.png
    sips -Z '84'  "${FILE}" --out "${DIR}"/GraphicCircular42mm2x.png
    sips -Z '94'  "${FILE}" --out "${DIR}"/GraphicCircular44mm2x.png
    sips -Z '40'  "${FILE}" --out "${DIR}"/GraphicCorner40mm2x.png
    sips -Z '40'  "${FILE}" --out "${DIR}"/GraphicCorner42mm2x.png
    sips -Z '44'  "${FILE}" --out "${DIR}"/GraphicCorner44mm2x.png
    sips -Z '52'  "${FILE}" --out "${DIR}"/GraphicModular38mm2x.png
    sips -Z '58'  "${FILE}" --out "${DIR}"/GraphicModular40mm2x.png
    sips -Z '58'  "${FILE}" --out "${DIR}"/GraphicModular42mm2x.png
    sips -Z '64'  "${FILE}" --out "${DIR}"/GraphicModular44mm2x.png
    sips -Z '40'  "${FILE}" --out "${DIR}"/GraphicUtilitarian38mm2x.png
    sips -Z '44'  "${FILE}" --out "${DIR}"/GraphicUtilitarian40mm2x.png
    sips -Z '44'  "${FILE}" --out "${DIR}"/GraphicUtilitarian42mm2x.png
    sips -Z '50'  "${FILE}" --out "${DIR}"/GraphicUtilitarian44mm2x.png
    echo "NOTE: Graphic Extra Large is not generated since that is not rectangular"
fi

@bpollman
Copy link

bpollman commented Feb 1, 2021

Awesome script! I tweaked it to take a PDF here https://gist.github.com/bpollman/f2e21b76dd382a0306776b010993434c

@brutella
Copy link
Author

brutella commented Feb 3, 2021

@bpollman Thanks, merged your changes. 🎉

Copy link

ghost commented Dec 11, 2021

Awesome work. Saved me from doing a lot of tedious resizing. It seems there are new complications size now (Graphic Extra Large and Graphic Large Rectangular) though.

@raddevus
Copy link

This script was fantastic and helped a ton. So glad I didn't have to manually do the work to create all of those images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment