1 |
#!/usr/local/bin/perl -w |
2 |
|
3 |
use Image::Magick; |
4 |
|
5 |
sub dump_gif { |
6 |
my ($text) = @_; |
7 |
my $file=$text; |
8 |
$file=~s/[^a-zA-Z]+/_/g; |
9 |
|
10 |
print "$text"; |
11 |
|
12 |
$image = Image::Magick->new; |
13 |
$image->Set(size=>'125x15'); |
14 |
#$image->Set(size=>'250x30'); |
15 |
#$image->ReadImage('xc:#2a377e'); |
16 |
$image->Read(filename=>"gif:template/contact.gif"); |
17 |
|
18 |
$image->Scale(geometry=>'200%'); |
19 |
|
20 |
($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = |
21 |
split(', ', $image->QueryFontMetrics(text=>$text,font=>"\@/usr/local/ttfonts/arialbd.ttf", pointsize=>20)); |
22 |
|
23 |
print "$x_ppem"; |
24 |
|
25 |
$image->Annotate(text=>$text, |
26 |
geometry=>'+14+4', |
27 |
font=>"\@/usr/local/ttfonts/arialbd.ttf", |
28 |
pointsize=>20, |
29 |
pen=>'white', |
30 |
align=>'left'); |
31 |
|
32 |
|
33 |
#$image->Resize(geometry=>'125x15', filter=>'Lanczos', blur=>1.8); |
34 |
#$image->GaussianBlur(radius=>1); |
35 |
$image->Scale(geometry=>'50%'); |
36 |
|
37 |
$image->Draw(stroke=>'#cccccc', primitive=>'line', points=>'0,14 118,14', linewidth=>1); |
38 |
$image->Draw(stroke=>'#cccccc', primitive=>'line', points=>'118,14 118,7', linewidth=>2); |
39 |
|
40 |
|
41 |
if (0) { |
42 |
$image->Annotate(text=> |
43 |
geometry=>'+7+2', |
44 |
font=>"\@/usr/local/ttfonts/arialbd.ttf", |
45 |
pointsize=>10, |
46 |
pen=>'white', |
47 |
align=>'left'); |
48 |
} |
49 |
|
50 |
print " -> "; |
51 |
|
52 |
$image->Write(filename=>"gif:$file.gif", |
53 |
colors=>256, |
54 |
interlace=>"none", |
55 |
compress=>'lzw'); |
56 |
|
57 |
print "$file.gif\n"; |
58 |
|
59 |
} |
60 |
|
61 |
foreach (@ARGV) { |
62 |
dump_gif($_); |
63 |
} |