use GD;
use strict;
use warnings;

my $bild = new GD::Image(100,100);
my $gray = $bild->colorAllocate(200,200,200);
my $blue = $bild->colorAllocate(0,0,255);
my $red = $bild->colorAllocate(255,0,0);
my $black = $bild->colorAllocate(0,0,0);

# Quellbild (blauer Hintergrund, lauter rote Punkte
my $quelle = new GD::Image(100,100);
my $b = $quelle->colorAllocate(0,0,255);
my $r = $quelle->colorAllocate(255,0,0);
for (my $i=0;$i<=100;$i=$i+2)
  {
  for (my $j=0;$j<=100;$j=$j+2)
    { $quelle->setPixel($i,$j,$r); }
  }

# Quell-Ausschnitt (40x30 Pixel) an zwei verschiedene
# Stellen kopieren
$bild->copy($quelle,0,0,0,0,40,30);
$bild->copy($quelle,50,50,0,0,40,30);

open(OUT, ">", "gd-bild14.gif");
binmode OUT;   # nur bei Windows noetig
print OUT $bild->gif;
close OUT;