Skip to content

Instantly share code, notes, and snippets.

@linakis
Created April 15, 2016 11:50
Show Gist options
  • Save linakis/5ec17ced1dff0273cfe1ec7493b5fb97 to your computer and use it in GitHub Desktop.
Save linakis/5ec17ced1dff0273cfe1ec7493b5fb97 to your computer and use it in GitHub Desktop.
Imagemagick bash script to generate portrait iOS app store screenshots from 6+ input
#!/bin/sh
# Generate iPhone Portrait Screenshots from 6+ for app store submission.
# From folder containing 6+ screenshots do:
# ./generate-ios-screenshots.sh *.png
mkdir -p 3.5
mkdir -p 4.0
mkdir -p 4.7
mkdir -p 5.5
for base in "$@"
do
WIDTH=`identify -format '%w' -quiet "$base"`
HEIGHT=`identify -format '%h' -quiet "$base"`
if [ $WIDTH -eq 1242 -a $HEIGHT -eq 2208 ]; then
dest=${base//jpg/png}
convert "$base" -resize 640x1136! 4.0/"$dest"
convert "$base" -resize 750x1334! 4.7/"$dest"
cp "$base" 5.5/"$dest"
# remove status bar to save some height for 3.5" 3:2 aspect ratio
mogrify -crop 1242x2208+0+54 -quiet "$dest"
# resize keeping 16:9 aspect ratio and put it in a 3:2 canvas
convert "$base" -resize 540x960! -gravity center -background transparent -extent 640x960 3.5/"$dest"
# remove base file, we can find it's duplicate at 5.5 folder
rm "$base"
echo "[OK] $base"
else
echo "[ERROR] $base not 6+ Screenshot"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment