Skip to content

Instantly share code, notes, and snippets.

@embassem
Forked from yoichitgy/genscreenshots.sh
Created April 17, 2016 12:09
Show Gist options
  • Save embassem/cb58371a998b956c52f22bd7750a76cb to your computer and use it in GitHub Desktop.
Save embassem/cb58371a998b956c52f22bd7750a76cb to your computer and use it in GitHub Desktop.
A shell script to generates screenshot images from PSD files to submit to iTunes Connect (App Store). It removes the alpha channel of the source 5.5 inch images, and resizes and crops them to generate 4.7, 4 and 3.5 inch images.
#!/bin/sh
# settings ==========
filePrefix=""
destDir="./output/"
destDir5_5=$destDir"5.5inch/"
destDir4_7=$destDir"4.7inch/"
destDir4=$destDir"4inch/"
destDir3_5=$destDir"3.5inch/"
# ====================
# create dest directory
mkdir $destDir
mkdir $destDir5_5
mkdir $destDir4_7
mkdir $destDir4
mkdir $destDir3_5
# loop for 5.5inch
echo "5.5inch"
for i in 1 2 3 4 5
do
destFilePath=$destDir5_5$filePrefix$i".png"
echo $destFilePath
convert $filePrefix$i".psd[0]" $destFilePath
convert $destFilePath -background white -flatten $destFilePath
done
# loop for 4.7inch
echo "4.7inch"
for i in 1 2 3 4 5
do
sourceFilePath=$destDir5_5$filePrefix$i".png"
destFilePath=$destDir4_7$filePrefix$i".png"
echo $destFilePath
convert -resize x1334 $sourceFilePath $destFilePath
done
# loop for 4inch
echo "4inch"
for i in 1 2 3 4 5
do
sourceFilePath=$destDir5_5$filePrefix$i".png"
destFilePath=$destDir4$filePrefix$i".png"
echo $destFilePath
convert -resize 640x $sourceFilePath $destFilePath
convert -crop 640x1136+0+0 $destFilePath $destFilePath
done
# loop for 3.5inch
echo "3.5inch"
for i in 1 2 3 4 5
do
sourceFilePath=$destDir4$filePrefix$i".png"
destFilePath=$destDir3_5$filePrefix$i".png"
echo $destFilePath
convert -crop 640x960+0+0 $sourceFilePath $destFilePath
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment