shell脚本 将非9图和不在黑名单中的png转webp
发布时间:2020-12-15 16:17:08 所属栏目:安全 来源:网络整理
导读:# !/bin/bash# function: convert all png images file (except for ".9.png")in the current directory and subdirectories to webp formatecho "Starting convert images format,please wait a minite..."con=".9.png"extra=`cat extra`for var in `find
# !/bin/bash # function: convert all png images file (except for ".9.png")in the current directory and subdirectories to webp format echo "Starting convert images format,please wait a minite..." con=".9.png" extra=`cat extra` for var in `find . -name "*.png"`; do flag=1 fileName=${var##*/} file=${fileName%%.*} for ex in $extra; do if [ "$file" = "$ex" ]; then # echo find $ex = $file flag=0 break fi done if [ "$flag" -eq 0 ]; then continue fi if [[ $var =~ $con ]]; then echo $var " will not be compressed" else echo $var cwebp -q 70 $var -o ${var%.*}.webp rm $var fi done echo "Convert task complete!" (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |