>>509@C/C++の宿題やらせてください。9代目
#!/usr/local/bin/perl
use GD;
$file1 = "test2.jpeg";
$file2 = "test1.jpeg";
open (IMG,$file1);
$image1 = newFromJpeg GD::Image(IMG);
close(IMG);
open (IMG,$file2);
$image2 = newFromJpeg GD::Image(IMG);
close(IMG);
($w1, $h1) = $image1->getBounds();
($w2, $h2) = $image2->getBounds();
$width = $w1 + $w2;
$height = ($h1>$h2)?$h1:$h2;
my $target = new GD::Image($width, $height);
$target->copy($image1, 0, 0, 0, 0, $w1, $h1);
$target->copy($image2, $w1, 0, 0, 0, $w2, $h2);
print "content-type:image/jpeg\n\n";
print $target->jpeg;