#!/usr/bin/perl -wT
use GD;
use strict;
my $image = new GD::Image( 100, 100 );
my $white = $image->colorAllocate( 255, 255, 255 );
my $black = $image->colorAllocate( 0, 0, 0 );
my $red = $image->colorAllocate( 255, 0, 0 );
$image->arc( 50, 50, 95, 75, 0, 360, $black );
$image->fill( 50, 50, $red );
print "Content-type: image/png\n\n";
print $image->png;
However, the output will result in a broken image if we run the
application on a platform mentioned above. The solution is to use the
binmode function to treat the resulting output
as binary information: