Last active
September 9, 2015 15:47
-
-
Save smison/c2fd75606941eebff804 to your computer and use it in GitHub Desktop.
同じディレクトリのpng画像を長辺900pxにリサイズするbashスクリプト(http://qiita.com/smison/items/384a70020ee0e715be31)
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/bash | |
cd `dirname $0` | |
for fname in *.png; do | |
height=`identify -format '%h' ${fname}` | |
width=`identify -format '%w' ${fname}` | |
basename=`basename ${fname} .png` | |
if [ ${height} -ge ${width} ]; then | |
convert -resize x900 ${fname} ${basename}_resized.png | |
else | |
convert -resize 900x ${fname} ${basename}_resized.png | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment