1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| #!usr/bin/perl -w
use strict;
use GD;
my $im = new GD::Image(100,100);
my $white = $im->colorAllocate(255,255,255);
my $black = $im->colorAllocate(0,0,0);
my $red = $im->colorAllocate(255,0,0);
my $blue = $im->colorAllocate(0,0,255);
$im->transparent($white);
$im->interlaced('true');
$im->rectangle(0,0,99,99,$black);
$im->string(gdSmallFont,10,10,"rectangle",$blue);
$im->fill(50,50,$red);
open(PNG, '>', "couleur.png") || die "Erreur d'ecriture : $!";
binmode PNG;
print PNG $im->png;
close PNG; |
Partager