use strict; use warnings; use GD; my $width = 1000; my $height = 100; my $image_file = q#output_image.png#; my $image = GD::Image->new($width, $height); my $white = $image->colorAllocate(255, 255, 255); my $black = $image->colorAllocate(0, 0, 0); $image->filledRectangle(0, 0, $width - 1, $height - 1, $white); my $font_path = q#c:/windows/fonts/cour.ttf#; my $font_size = 14; $image->stringFT($black, $font_path, $font_size, 0, 20, 75, '2 5 5 2 5 5 2 5 5'); open TEMP, q/>/, qq/$image_file/; binmode TEMP; print TEMP $image->png; close TEMP;