Created
March 5, 2017 00:51
-
-
Save strobic/eb599c0605cdb430d4fb077e46e30b4f to your computer and use it in GitHub Desktop.
A Bash Script to Generate All the Required App Icon Sizes for iOS
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/bash | |
#This script will automatically generate all correct sized icons for IOS x and Later | |
#from a single .svg file | |
#This script requires ImageMagick (macport or brew it or something) | |
#usage is: | |
#>./createIcons.sh [source_file_name].svg | |
echo $1 | |
fullfile=$1 | |
filename=$(basename "$fullfile") | |
extension="${filename##*.}" | |
filename="${filename%.*}" | |
echo $filename | |
echo $extension | |
if [[ "$extension" != "svg" ]]; then | |
echo "Input file with svg extension is required." | |
return | |
fi | |
echo "Input file extension is valid" | |
echo "Make output directory" | |
rm -r $filename | |
mkdir $filename | |
echo "Create files" | |
P29=`bc <<< "scale=4; 72.5/60*29"` | |
P58=`bc <<< "scale=4; 72.5/60*58"` | |
P87=`bc <<< "scale=4; 72/60*87"` | |
P40=`bc <<< "scale=4; 72/60*40"` | |
P60=`bc <<< "scale=4; 72/60*60"` | |
P80=`bc <<< "scale=4; 72/60*80"` | |
P120=`bc <<< "scale=4; 72/60*120"` | |
P180=`bc <<< "scale=4; 72/60*180"` | |
P1024=`bc <<< "scale=4; 72/60*1024"` | |
convert -density $P29x$P29 $fullfile ./$filename/"$filename"_settings.png | |
convert -density $P58x$P58 $fullfile ./$filename/"$filename"[email protected] | |
convert -density $P87x$P87 $fullfile ./$filename/"$filename"[email protected] | |
convert -density $P40x$P40 $fullfile ./$filename/"$filename"[email protected] | |
convert -density $P60x$P60 $fullfile ./$filename/"$filename"[email protected] | |
convert -density $P80x$P80 $fullfile ./$filename/"$filename"[email protected] | |
convert -density $P120x$P120 $fullfile ./$filename/"$filename"[email protected] | |
convert -density $P60x$P60 $fullfile ./$filename/"$filename"_app.png | |
convert -density $P120x$P120 $fullfile ./$filename/"$filename"[email protected] | |
convert -density $P180x$P180 $fullfile ./$filename/"$filename"[email protected] | |
convert -density $P1024x$P1024 $fullfile ./$filename/"$filename"_store.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment