use strict;
use warnings;
use GD;

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->copyResized($quelle,0,0,0,0,80,60,40,30); # doppelt gross
$bild->copyResized($quelle,50,50,0,0,20,15,40,30); # halbiert

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