#!/usr/bin/perl -w # this script outputs a gif # set color, width, and height use strict; $|++; binmode STDOUT; print "Content-Type: image/gif\n\n"; print gif_file "FF0000", 0x33, 0x10; ###################################### sub gif_file{ my ($hexrgb, $wid, $hgh) = @_; my %c; @c{qw(r g b)} = map hex, unpack "A2"x3, $hexrgb; return pack "C*", ( 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, $wid, 0x00, $hgh, 0x00, 0xA1, 0x01, 0x00, $c{r}, $c{g}, $c{b}, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0xF9, 0x04, 0x05, 0x00, 0x00, 0x01, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, $wid, 0x00, $hgh, 0x00, 0x40, 0x02, $hgh, 0x84, 0x8F, 0xA9, 0xCB, 0xED, 0x0F, 0xA3, 0x9C, 0xB4, 0xDA, 0x8B, 0xB3, 0xDE, 0x9C, 0x17, 0x00, 0x3B, ); }