> require "cgi"
> cgi = CGI.new("html4")
> cgi.out('image/png') do
>    File.read("#{cgi['id']}.png")
> end

Still doesn't seem to nail it. Firefox reports the page as
'text/plain'. Hitting the URL directly doesn't pull the image, using
 produces a broken link. In Safari, it downloads
endlessly.

I'm not sure what CGI is doing behind the scenes with cgi.out. From
what I read in the docs, it seems like cgi.out is supposed to write
the header for you, but the header I'm getting is very sparse:

HTTP/1.x 200 OK
Connection: close
Date: Wed, 20 Apr 2005 19:20:41 GMT
Server: lighttpd/1.3.13

I should at least see Content-Type: image/png in the header.

I also haven't ruled out lighttpd in this case, but it's much more
likely I'm doing something wrong, not lighttpd.