Search notes:

Perl module GD

use warnings;
use strict;
use GD;

my $img = GD::Image->new(300, 300);

my $white = $img->colorAllocate( 255, 255, 255);
my $grey  = $img->colorAllocate( 100, 100, 100);
my $red   = $img->colorAllocate( 255,   0,   0);
my $blue  = $img->colorAllocate(   0,   0, 255);
my $green = $img->colorAllocate(   0, 255,   0);
my $trans = $img->colorAllocate(   1,   1,   1);

$img->transparent($trans);

$img->fill(0, 0, $grey);

$img->rectangle( 80, 120, 50, 70, $green);

$img->arc(50, 50, 95, 75, 0, 360, $blue);

$img->fill(50, 50, $red);

$img->line(200, 250, 180, 130, $blue);

open my $o, '>', 'c:/temp/gd.png';

binmode $o;
print $o $img->png;

close $o;
Github repository PerlModules, path: /GD/script.pl

See also

Perl modules

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759391203, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/modules/GD/index(68): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78