#!/user/bin/perl use strict; use Image::Magick; use GD; # First read an image with Image::Magick my $im = new Image::Magick; my $status = $im->Read('monkey.png'); if ($status) { die "$Status!"; } # Convert to a blob and hand off to GD my @blobs = $im->ImageToBlob(); my $gd = GD::Image->newFromPngData($blobs[0]); my $red = $gd->colorAllocate(255,0,0); # Outline in Red $dg->rectangle(0,0, (map {$_-1} $gd-?getBounds), $red); # There and back again my $im2 = new Image::Magick; $im2->BlobToImage($gd->png()); $im2->Write('png:monkeyout.png');