procimage

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

TXT
55
字号
# Set up the defaultssize=320width=1colour="-color black"usage="Usage: $0 [-s N] [-w N] [-c S] imagefile..."while getopts ":s:w:c:" opt; do    case $opt in      s  ) size=$OPTARG ;;      w  ) width=$OPTARG ;;      c  ) colour="-color $OPTARG" ;;      \? ) echo $usage           exit 1 ;;    esacdoneshift $(($OPTIND - 1))if [ -z "$@" ]; then    echo $usage    exit 1fi# Process the input filesfor filename in "$*"; do    ppmfile=${filename%.*}.ppm    case $filename in        *.gif ) giftopnm $filename > $ppmfile ;;        *.tga ) tgatoppm $filename > $ppmfile ;;        *.xpm ) xpmtoppm $filename > $ppmfile ;;        *.pcx ) pcxtoppm $filename > $ppmfile ;;        *.tif ) tifftopnm $filename > $ppmfile ;;        *.jpg ) djpeg $filename > $ppmfile ;;            * ) echo "$0: Unknown filetype '${filename##*.}'"                exit 1;;    esac    outfile=${ppmfile%.ppm}.new.gif    pnmscale -quiet -xysize $size $size $ppmfile |        pnmmargin $colour $width |        ppmquant -quiet 256 | ppmtogif -quiet > $outfile    rm $ppmfiledone

⌨️ 快捷键说明

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