Created
March 13, 2015 11:40
-
-
Save yoichitgy/7d34087f2871a61df8a3 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.
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/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 |
To use the shell script:
- Install ImageMagick
- Prepare 1.psd, 2.psd, 3.psd, 4.psd and 5.psd in 1242 x 2208 pixels for 5.5 inch screen iPhone. The filenames can have a prefix defined as
filePrefix
in the script. - Run the script where the PSD files are located.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on this gist:
https://gist.github.com/haranicle/55debc2e46ef643341cc