Home | Mirror | Search

2. convert

2.1. 批量轉換

convert *.jpg gkp-*.png
			

2.2. resize

批量修改圖片尺寸

			
find ./ -name '*.jpg' -exec convert -resize 600x480 {} {} \;
			
			

以長邊為準

for img in $(find ./album/ -type f -name *.jpg)
do
        width=$(identify -format "%w" $img)
        height=$(identify -format "%h" $img)
        if [ $width -gt $height ]; then
                convert -resize 900x600 $img $img
        else
                convert -resize 600x900 $img $img
        fi
done
			
comments powered by Disqus