<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/local/bin/perl

use GD;

$im = new GD::Image(300,300);

# allocate white
$white = $im-&gt;colorAllocate(255, 255, 255);        

# allocate black
$black = $im-&gt;colorAllocate(0, 0, 0);

# allocate red
$red = $im-&gt;colorAllocate(255, 0, 0);      

# allocate green
$green = $im-&gt;colorAllocate(0,255,0);

# allocate yellow
$yellow = $im-&gt;colorAllocate(255,250,205);

# Get an image from a png file
open (TILE,"./tile.png") || die;
$tile = newFromPng GD::Image(TILE);
close TILE;

# use it as a paintbrush
$im-&gt;setBrush($tile);
$im-&gt;arc(100,100,100,150,0,360,gdBrushed);

# use it as a tiling pattern to fill a rectangle
$im-&gt;setTile($tile);
$im-&gt;filledRectangle(150,150,250,250,gdTiled);
$im-&gt;rectangle(150,150,250,250,$black);

# Draw a dotted line 
$im-&gt;setStyle($green,$green,$green,gdTransparent,$red,$red,$red,gdTransparent);
$im-&gt;line(0,280,300,280,gdStyled);

binmode STDOUT;

# print the image to stdout
print $im-&gt;png;

</pre></body></html>