If you have no HTML around it, and just want to send back the image as the response to the URL, just generate it and send the right header, like
Content-type: image/jpeg for a JPEG. (Aside: Be sure to put the space after the colon: far too many web examples and code posted here leaves it out, and that breaks things.)
If you want the image embedded into the rest of an output HTML page, I have a column on that, so you
can use that as a starting point.
-- Randal L. Schwartz, Perl hacker