1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #!/bin/bash # Take user parameters or set defaults rulername="$1" rulerlength="$2" rulername="${rulername:=ruler.gif}" rulerlength="${rulerlength:=572}" drawstring="" #Build the line definitions for the ruler marks for x1 in `seq 0 72 $rulerlength`; do drawstring="$drawstring line $x1,70 $x1,100" for x2 in 0 36; do (( offset = $x1 + $x2 )) drawstring="$drawstring line $offset,80 $offset,100" for x3 in `seq 6 6 30`; do (( offset2 = $offset + $x3 )) drawstring="$drawstring line $offset2,90 $offset2,100" done done done #Add the labels labelfont="-fill black -font helvetica -pointsize 24 -draw" labelstring="text 0,60 \"0\" " for x1 in 72; do (( offset = $x1 - 12 )) labelstring="$labelstring text $offset,60 \"$x1\" " done for x1 in `seq 144 72 $rulerlength`; do (( offset = $x1 - 18 )) labelstring="$labelstring text $offset,60 \"$x1\" " done #Create the ruler convert -size "${rulerlength}x100" xc:lightblue -fill black \ -draw "$drawstring" $labelfont "$labelstring" "$rulername" |
1 2 3 4 | $ convert -fill NavyBlue -background Lavender -font helvetica -pointsize 36 \ label:"Pixel Ruler" label.gif $ identify "label.gif" label.gif GIF 175x36 175x36+0+0 8-bit PseudoClass 256c 1.98kb |
1 2 3 | $ convert -size 572x100 xc:lightblue -font helvetica -pointsize 36 \ -fill black -undercolor lavender -annotate +40+50 'Pixel Ruler' -trim info: xc:lightblue XC 174x36 572x100+40+23 16-bit DirectClass |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #!/bin/bash # Take user parameters or set defaults rulername="$1" rulerlength="$2" rulername="${rulername:=ruler.gif}" rulerlength="${rulerlength:=572}" drawstring="" #Build the line definitions for the ruler marks for x1 in `seq 0 72 $rulerlength`; do drawstring="$drawstring line $x1,70 $x1,100" for x2 in 0 36; do (( offset = $x1 + $x2 )) drawstring="$drawstring line $offset,80 $offset,100" for x3 in `seq 6 6 30`; do (( offset2 = $offset + $x3 )) drawstring="$drawstring line $offset2,90 $offset2,100" done done done #Add the labels labelfont="-fill black -font helvetica -pointsize 24 -draw" labelstring="text 0,60 '0' " for x3 in 72; do offset3=$(($x3 - 12 )) labelstring="$labelstring text $offset3,60 '$x3' " done for x4 in `seq 144 72 $rulerlength`; do offset4=$(( $x4 - 18 )) labelstring="$labelstring text $offset4,60 '$x4' " done #Add a title titledimension=$(convert -size 572x100 xc:lightblue -font helvetica \ -pointsize 36 -fill black -undercolor lavender\ -annotate +40+50 'Pixel Ruler' -trim info: | awk ' {print $3 } ') titlewidth=${titledimension%x*} titlefont="-fill NavyBlue -font helvetica -pointsize 36" titlepos=$(( (($rulerlength - $titlewidth)) / 2 )) titletext="text $titlepos,30 'Pixel Ruler' " #Create the ruler convert -size "${rulerlength}x100" xc:lightblue \ -fill black -draw "$drawstring" $labelfont "$labelstring" \ $titlefont -draw "$titletext" "$rulername" |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |