style-light-choice
style-dark-choice 
Avatar
Gary
Vollink.com
9 November 2005

GD Lightning Talk

GD is a powerful but lightweight graphics module, which is a Perl wrapper of libgd.  The Perl GD module is available here

The simplest result from GD is the plain white image...

use GD;

MAIN: {
	my $banner;
	my $white;

	# Create a new image, 400 Pixels (px) wide by 66px tall, using truecolor
		# I will need truecolor later in this example.
	$banner = GD::Image->new(400, 66, 1);

	# Allocate a color to use in the image
	$white = $banner->colorAllocate(255,255,255);

	# White Background
	$banner->fill(1,1,$white);

	# Create result 1...
	open($fh, '>', "bn_1.png");
	print $fh $banner->png();
	close($fh);
}

Result 1:
banner size rectangle, blank with white background

 

Valid CSS!