#!/usr/bin/perl -w # Download an image from the web and outline it in red use strict; use GD; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); my $request = new HTTP::Request('GET', 'http://as220.org/images/people/shawn2.png'); my $response = $ua->request($request); my $image_data = $response->content(); my $image = GD::Image->newFromPngData($image_data); my ($w, $h) = $image->getBounds(); my $brush = new GD::Image(4, 4); $brush->rectangle(0, 0, 4, 4, $image->colorAllocate(255, 0, 0)); $image->setBrush($brush); $image->rectangle(0, 0, $w, $h, gdBrushed); print $image->png;