use GD; my $img = GD::Image->new( $width, $height ); # The first color allocated becomes the background color $img->colorAllocate( 255, 0, 0 ); # $img->jpeg will return the image data, you can then # save it to a file, or print it with an image/jpeg # header or whatever you want to do... print $img->jpeg();