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

文章目录

    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
    

    环境

    • Ubuntu 16.10
    • ImageMagick 6.8.9

    参考

    关于作者 🌱

    我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊,或者关注我的个人公众号“大象工具”, 查看更多联系方式