Ubuntu 下使用 shell 脚本批量修改图片尺寸

发布时间: 2017-04-08 09:44:57 作者: 大象笔记

Ubuntu 下需要安装 ImageMagick。执行

sudo apt-get install imagemagick

使用 shell 脚本遍历当前目录中的所有 png 图片,并逐一处理

set -e  # or use "set -o errexit" to quit on error.
set -x  # or use "set -o xtrace" to print the statement before you execute it.

FILES=*.png
for f in $FILES
do
        echo "$f"
        convert $f -resize 600x600 600_$f
done

环境

参考

我是一名山东烟台的开发者,联系作者