LoginSignup
1
1

More than 5 years have passed since last update.

ImageMagickで画像一括リサイズ

Last updated at Posted at 2015-05-14

Macのスクショのファイル名にスペース入ってくるのに対応。

#!/bin/bash

# 画像ファイル一覧
images="${HOME}/Desktop/*.png"
# 出力サイズ
DEST_WIDTH=400
DEST_HEIGHT=400

for image in $images; do
    echo "load ${image}"
    imageWidth=`identify -format "%w" "${image}"`;
    resized="no resize"
    if [ ${imageWidth} -gt ${DEST_WIDTH} ]; then
        convert "${image}" -resize ${DEST_WIDTH}x${DEST_HEIGHT} "${image}";
        resized="complete resized"
    fi
    echo $resized `identify -format "%wx%h" "${image}"`;  
done
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1