Skip to content

Instantly share code, notes, and snippets.

@sanukin39
Last active May 2, 2016 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanukin39/798ba9dcc45cd76d7dce6398acb10b1b to your computer and use it in GitHub Desktop.
Save sanukin39/798ba9dcc45cd76d7dce6398acb10b1b to your computer and use it in GitHub Desktop.
imagemagickを使ってiOSのアプリ申請に必要なサイズの画像を一括で変換するスクリプト
#!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