Skip to content

Instantly share code, notes, and snippets.

@smison
Last active September 9, 2015 15:47
Show Gist options
  • Save smison/c2fd75606941eebff804 to your computer and use it in GitHub Desktop.
Save smison/c2fd75606941eebff804 to your computer and use it in GitHub Desktop.
同じディレクトリのpng画像を長辺900pxにリサイズするbashスクリプト(http://qiita.com/smison/items/384a70020ee0e715be31)
#! /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