Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem writing bitmap image to HTTP response stream.

Reply
Thread Tools

Problem writing bitmap image to HTTP response stream.

 
 
Guest
Posts: n/a
 
      08-18-2004
Hello All,

I am writing a web application that reads a bitmap from a file and outputing
it to a HTTP response stream to return the image to the requesting client.
The image file is a regular bitmap file (filename.bmp)

I am experiencing some difficulties with writing a bitmap to a http response
stream.
I load the bitmap from a file. and i use the following snippet of code to
write to HTTP response stream

Bitmap bmp;
//...load bmp with bitmap data from file
Response.ContentType = "image/bmp";
bmp.Save (Response.OutputStream, ImageFormat.Bmp);

After this code is called, I get an Exception message, "A generic error
occurred in GDI+.".

I know that the bitmap is ok since I am able to save it back to file again
with:
bmp.Save("somefilename.bmp",ImageFormat.Bmp);

Would anyone be able to shed some light with this problem.


Thanks


 
Reply With Quote
 
 
 
 
S. Justin Gengo
Guest
Posts: n/a
 
      08-18-2004
Buzlite,

If you'd like I have an image manipulation project (Visual Studio.NET v.1.1)
that you may download from my website, www.aboutfortunate.com.

The project is free and includes all source code. It includes an interface
for uploading, manipulating, and then saving an image. During the
manipulation of the image the image is retrieved from an in memory stream
which is output using Response.Content type. Looking at the code there may
give you a clue as to what needs to be changed in your code.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<> wrote in message
news:...
> Hello All,
>
> I am writing a web application that reads a bitmap from a file and
> outputing
> it to a HTTP response stream to return the image to the requesting client.
> The image file is a regular bitmap file (filename.bmp)
>
> I am experiencing some difficulties with writing a bitmap to a http
> response
> stream.
> I load the bitmap from a file. and i use the following snippet of code to
> write to HTTP response stream
>
> Bitmap bmp;
> //...load bmp with bitmap data from file
> Response.ContentType = "image/bmp";
> bmp.Save (Response.OutputStream, ImageFormat.Bmp);
>
> After this code is called, I get an Exception message, "A generic error
> occurred in GDI+.".
>
> I know that the bitmap is ok since I am able to save it back to file again
> with:
> bmp.Save("somefilename.bmp",ImageFormat.Bmp);
>
> Would anyone be able to shed some light with this problem.
>
>
> Thanks
>
>



 
Reply With Quote
 
 
 
 
Joerg Jooss
Guest
Posts: n/a
 
      08-18-2004
wrote:
> Hello All,
>
> I am writing a web application that reads a bitmap from a file and
> outputing it to a HTTP response stream to return the image to the
> requesting client. The image file is a regular bitmap file
> (filename.bmp)
>
> I am experiencing some difficulties with writing a bitmap to a http
> response stream.
> I load the bitmap from a file. and i use the following snippet of
> code to write to HTTP response stream
>
> Bitmap bmp;
> //...load bmp with bitmap data from file
> Response.ContentType = "image/bmp";
> bmp.Save (Response.OutputStream, ImageFormat.Bmp);


You could try another API instead, e.g. HttpResponse.WriteFile().

Cheers,

--
Joerg Jooss

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! How can I draw a bitmap only with BITMAP information! xqggz C++ 1 06-19-2007 03:07 PM
return HttpStatusCode.ServiceUnavailable in the context.context.Response.StatusCode (Http response code 503) Flip Rayner ASP .Net 1 01-23-2007 06:35 AM
how can i simulate my pc as http server by writing java code to send the http response by socketstream to some pc in the internet?! mike Java 5 09-21-2004 02:04 PM
Masked bitmap from bitmap Gandalf Python 0 01-29-2004 09:41 PM
saving a bitmap image but not to response.outputstream Joseff ASP .Net 1 01-09-2004 08:04 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57