Hi. I’ve written a webserver for my EMX and I’m trying to get it to serve images. Doing google searches seems to indicate there is a difference between BMPs created via the following and the same thing via the regular .NET framework. It wasn’t all clear to me.
Does anyone know why the following won’t work… or know the proper way to do this? color_brown_151 is setup as an image resource. The code is crashing a the response.OutputStream.Write with no helpful information. However, if I give it a bad response.ContentType such as imageS/bmp, the byte array seems to transfer without error (but, of course, is not recognized as an image and shows ascii garbage in the web browser)
if (context.Request.RawUrl == “/color_brown_151.jpg”)
Bitmap image = Resource1.GetBitmap(Resource1.BitmapResources.color_brown_151);
response.ContentType = “image/bmp”;
byte byte_image = image.GetBitmap();
response.OutputStream.Write(byte_image, 0, byte_image.Length);