in reply to Random Image Generator

Try to do this simple testing, and help you to narrow down the problem: Write the image to a file, then use IE or whatever you have to open the image file as a local file (c: something something), not over network. If the image does not show up, then it has a bad format, blokhead had a very good guess already; If the image does show up, then the problem would be the way you form your http or html.