用perl如何做出gif图?

hanxiang 2000-09-05 01:04:00
我想用perl做股票的k线图(gif格式的,与数据库挂钩,5分钟k线)。然后发到网页去。请问哪位高手能给我讲一下
大概的步骤或方法?
...全文
161 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
xqterry 2000-09-05
  • 打赏
  • 举报
回复
用perl出gif图

起码不再为gif的版权头痛了。
需要下载gd.pm这个模块,请到
ftp://ftp-genome.wi.mit.edu/pub/software/WWW/GD.pm.tar.gz
下载并安装。
哈,不过,看来是没法支持ttf字体了,但据说好象有512种字型支持,win32下我不知道可不可以装,使用动态包含语句或许可以用吧。
全部是类调用,非常的爽,看例程:
#!/usr/local/bin/perl
use GD;
print "Content-type:image/gif\n\n";

# create a new image
$im = new GD::Image(100,100);
# allocate some colors
$white = $im->colorAllocate(255,255,255);
$black = $im->colorAllocate(0,0,0);
$red = $im->colorAllocate(255,0,0);
$blue = $im->colorAllocate(0,0,255);
# make the background transparent and interlaced
$im->transparent($white);
$im->interlaced('true');
# Put a black frame around the picture
$im->rectangle(0,0,99,99,$black);
# Draw a blue oval
$im->arc(50,50,95,75,0,360,$blue);
# And fill it with red
$im->fill(50,50,$red);
# make sure we are writing to a binary stream
binmode STDOUT;
# Convert the image to GIF and print it on standard output
print $im->gif;

2,204

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 CGI
社区管理员
  • CGI社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧