dominic 已修改 . 還原成這個修訂版本
1 file changed, 45 insertions
forum_sig.cron.sh(檔案已創建)
@@ -0,0 +1,45 @@ | |||
1 | + | #!/bin/sh | |
2 | + | # generate forum signatures for black and white backgrounds | |
3 | + | # files get optimized with optipng, advpng and pngcrush | |
4 | + | # you may want to install them; if you don't have them installed | |
5 | + | # the output files get not optimized | |
6 | + | # for random output I utilize a perl script `randomquote.pl` which | |
7 | + | # is not my own and the author does not want it to be re-distributed | |
8 | + | # so you might want to find something that suits your need | |
9 | + | # | |
10 | + | # Author: Dominic Reich <quick.hat4396@qtztsjosmprqmgtunjyf.com> | |
11 | + | # Last modified: 2024-01-15 02:36 | |
12 | + | # | |
13 | + | ||
14 | + | # font_path=/usr/local/share/fonts/spleen/ | |
15 | + | font_path=/usr/share/fonts/spleen | |
16 | + | # files create in actual dir _dark.png and _light.png are added to filename | |
17 | + | file_prefix=forumsig | |
18 | + | quote=$(~/bin/randomquote.pl | fold -sw 76) | |
19 | + | ||
20 | + | # dark | |
21 | + | convert -background black -fill \#ddd -font ${font_path}/spleen-32x64.otf \ | |
22 | + | -antialias -pointsize 20 label:"$quote" ${file_prefix}_dark.png | |
23 | + | ||
24 | + | # light | |
25 | + | convert -background white -fill \#222 -font ${font_path}/spleen-32x64.otf \ | |
26 | + | -antialias -pointsize 20 label:"$quote" ${file_prefix}_light.png | |
27 | + | ||
28 | + | missing="" | |
29 | + | ||
30 | + | command -v optipng > /dev/null 2>&1 || { missing="$missing optiping"; } | |
31 | + | command -v advpng > /dev/null 2>&1 || { missing="$missing advpng"; } | |
32 | + | command -v pngcrush > /dev/null 2>&1 || { missing="$missing pngcrush"; } | |
33 | + | ||
34 | + | if [ -n "$missing" ] | |
35 | + | then | |
36 | + | echo >&2 "could not find:$missing" | |
37 | + | exit 1 | |
38 | + | fi | |
39 | + | ||
40 | + | for file in ${file_prefix}_{dark,light}.png | |
41 | + | do | |
42 | + | optipng -nb -nc $file > /dev/null 2>&1 | |
43 | + | advpng -z4 $file > /dev/null 2>&1 | |
44 | + | pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow $file > /dev/null 2>&1 | |
45 | + | done |
上一頁
下一頁