Click to See Complete Forum and Search --> : Creating a gif image (without gd.pm)


swampy101
05-18-2004, 02:25 PM
I am trying to create a gif image (1*1 pixels) from a Perl script but am unsure of the syntax. Does anyone know the code to do this, or of a link to some code that gives an idea? For a number of reasons I don't want to use gd.pm.

What I want to do is have the script return a 1*1 or 2*2 etc image to the browser, the browser can then run a certain block of code depending on the width of the returned image. (a very long time ago I knew how to do this is in C but have since lost the archived code).

cheers

swampy101
05-18-2004, 02:44 PM
Found my own answer:

my @binary;
@binary = (71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,
249,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,0,1,1,50,0,59);

print "Content-Type: image/gif; charset=ISO-8859-1\r\n\r\n";
foreach (@binary) {print pack("C",$_)}

cheers