Last active
May 2, 2016 05:02
-
-
Save sanukin39/798ba9dcc45cd76d7dce6398acb10b1b to your computer and use it in GitHub Desktop.
imagemagickを使ってiOSのアプリ申請に必要なサイズの画像を一括で変換するスクリプト
This file contains hidden or 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 | |
array=('640x920' '640x1096' '750x1334' '1242x2208' '768x1024') | |
for dir in ${array[@]}; do | |
mkdir ${dir} | |
done | |
# 同フォルダ内にあるpng, jpgを取得 | |
for file in `\find . -maxdepth 1 -type f -name '*.png' -or -name '*.jpg'`; do | |
echo convert ${file} | |
for dir in ${array[@]}; do | |
w=`echo ${dir} | cut -d 'x' -f 1` | |
convert ${file} -resize ${w}x ${dir}/kari.png | |
cd ${dir} | |
convert kari.png -crop ${dir} ${file} | |
rm kari.png | |
rm *-1.png | |
cd .. | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment