Skip to content

Instantly share code, notes, and snippets.

@kazuhito-m
Created August 2, 2014 04:17
Show Gist options
  • Save kazuhito-m/970c7e94cf12617afb77 to your computer and use it in GitHub Desktop.
Save kazuhito-m/970c7e94cf12617afb77 to your computer and use it in GitHub Desktop.
#!/bin/bash
# 特定サイズの画像のサイズを縮小するスクリプト。
#
# 以下の環境を期待しているため、これを使う場合は以下を準備する。
# OS:Ubuntu
# コマンド:以下でインストール
# sudo apt-get install jhead imagemagick
IFS=$'\n'
for i in $(ls *.jpg *.jpeg) ; do
jhead "$i" | grep -q '3264 x 2448'
if [ "$?" -eq 0 ] ; then
mogrify -resize 800 "$i"
fi
jhead "$i" | grep -q '2448 x 3264'
if [ "$?" -eq 0 ] ; then
mogrify -resize 600 "$i"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment