谁有GD使用的经验啊?

谁有GD使用的经验啊?

谁有GD使用的经验啊?
我按照别人的例子如下运行后什么都没有出现也没有报错,请问为什么?

use GD;
my $gd = GD::Image->new(400,300);
my $white = $gd->colorAllocate(255, 255, 255);
my $black = $gd->colorAllocate( 0, 0, 0);
my $red = $gd->colorAllocate(255, 0, 0);
my $green = $gd->colorAllocate( 0, 255, 0);
my $blue = $gd->colorAllocate( 0, 0, 255);
my $yellow = $gd->colorAllocate(255, 255, 0);
$gd->filledRectangle(0, 129, 199, 169, $blue);
my $poly = GD::Polygon->new();
$poly->addPt(199, 149);
$poly->addPt(399, 74);
$poly->addPt(324, 149);
$poly->addPt(399, 224);
$gd->filledPolygon($poly, $yellow);
$gd->polygon ($poly, $black);
$gd->arc(199, 149, 250, 250, 0, 360, $red);
$gd->arc(199, 149, 100, 200, 0, 360, $red);
$gd->fillToBorder(99, 149, $red, $green);
$gd->rectangle(0, 0, 399, 299, $red);
$gd->line(199, 0, 199, 299, $red);
$gd->line(0, 149, 399, 149, $red);
你只是告诉 gd 要生成的图.
你只是告诉 gd 要生成的图片是什么样子,没有输出,当然看不到东西了。

[quote]
open my $iimg, ">image.png" or die $!;
binmode($img);
print $img $graph->plot(\@data)->png();
close $img;
[/quote]

gd 有多种输出方式,请看 GD 和你是用的相关 GD::* 文档 http://search.cpan.org/~lds/GD-2.19/GD.pm