Perl Programming Course for Bioinformatics and Internet
Simple GD Graphics
sample code

  use GD::Simple;

  # create a new image
  $img = GD::Simple->new(100,100);

  # draw a red rectangle with blue borders
  $img->bgcolor('red');
  $img->fgcolor('blue');
  $img->rectangle(10,10,50,50);
  print $img->png;

GD::Simple

sample code

  use GD::Simple;

  # create a new image
  $img = GD::Simple->new(300,100);

  # draw a string at (5,50)
  $img->moveTo(5,50);
  $img->font(gdGiantFont);
  $img->fgcolor('blue');
  $img->string('A simple line.');
  print $img->png;

# gdGiantFont, gdLargeFont, gdMediumBoldFont, gdSmallFont, gdTinyFont
GD::Simple

Defined GD:Simple colors name


Table of contents
Next