use strict; use GD; # create a new image my ($width,$height) = (50, 20); my $im = new GD::Image($width,$height); # allocate some colors my $white = $im->colorAllocate(255,255,255); my $black = $im->colorAllocate(0,0,0); # Put a black frame around the picture $im->rectangle(0,0,$width-1,$height-1,$black); # some TTF text: # (colour, font, pointsize, angle, x, y, string) my @bounds = $im->stringTTF($black,'c:/i386/times.ttf',14,0,2,17,'JaPh!'); if (!@bounds) {print "TTF error: $@\n";} for my $y (0..$height-1) { for my $x (0..$width-1) { print $im->getPixel($x,$y) ? 'X':'.'; } print "\n"; } print "\n";