tags:

views:

73

answers:

3
A: 

It may be that you need to call Flush on the Graphics instance, i.e.:

graphic.Flush();

Do this when you've finished all the drawing operations, before you emit the stream from the bitmap.

Daniel Earwicker
Stream is saved to file and served as a file to browser. The problem is the same even in local mode. The image saving code is not displayed here
Vnuk
That's the same thing I've done in the past, and I've found that occasionally the bitmap file would be blank unless I made the call to Flush before saving the bitmap, so probably a good idea to add it if you haven't already.
Daniel Earwicker
+3  A: 

This might be related to the EOI marker at the end of the image.

Something similar happened to me once and I vaguely remember that adding an EOI byte to the end of the JPG solved it.

I suggest you search the wiki page for EOI and try it.

Assaf Lavie
Yes!!!! Thats it! I've opened the image in UltraEdit, added FF D9 at the end and it is displayed ok in FF and IE. Thanks a lot!
Vnuk
:) Glad it helped. No idea why this is, btw.. would be nice if someone explained it.
Assaf Lavie
A: 

This depends on drawing context and may need calling Save or Flush method to solve as Earwicker said above.

terR0Q