procimage1

来自「linux脚本编程的例子」· 代码 · 共 56 行

TXT
56
字号
# Set up the defaultswidth=1colour='-color grey'usage="Usage: $0 [-S] [-s N] [-w N] [-c S] imagefile..."# Initialise the pipeline componentsstandardise=' | ppmquant -quiet 256 | ppmtogif -quiet'while getopts ":Ss:w:c:" opt; do    case $opt in      S  ) sharpness=' | pnmnlfilt -0.7 0.45' ;;      s  ) size=$OPTARG           scale=' | pnmscale -quiet -xysize $size $size' ;;      w  ) width=$OPTARG           border=' | pnmmargin $colour $width' ;;      c  ) colour="-color $OPTARG"           border=' | pnmmargin $colour $width' ;;      \? ) echo $usage           exit 1 ;;    esacdoneshift $(($OPTIND - 1))if [ -z "$@" ]; then    echo $usage    exit 1fi# Process the input filesfor filename in "$@"; do    case $filename in        *.gif ) convert=giftopnm  ;;        *.tga ) convert=tgatoppm  ;;        *.xpm ) convert=xpmtoppm  ;;        *.pcx ) convert=pcxtoppm  ;;        *.tif ) convert=tifftopnm  ;;        *.jpg ) convert=djpeg ;;            * ) echo "$0: Unknown filetype '${filename##*.}'"                exit 1;;    esac    outfile=${filename%.*}.new.gif    eval $convert $filename $scale $border $sharpness $standardise > $outfiledone

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?