in reply to Not Strictly A perl question.
You can have a CGI that outputs an image. Just make sure that you send out the right HTTP headers, including (and especially) Content-Type: image/jpeg . It wouldn't hurt to put the Content-Length: header in, too, since you know the size of your JPG. Then follow the headers with a couple of CRLF pairs and the contents of the JPG. Make sure that you set your file to binary mode using binmode if you're using an OS that cares (like Windoze).