How can I extract the original image stream from a System.Drawing.Bitmap object?

Posted by skolima on Stack Overflow See other posts from Stack Overflow or by skolima
Published on 2010-04-28T15:15:30Z Indexed on 2010/04/28 15:23 UTC
Read the original article Hit count: 291

Filed under:
|
|
|

I am embedding images into my assembly using .resx files. Upon runtime, I need to save the images into standalone files, restoring the original content. How can I extract the original file stream from an System.Drawing.Bitmap instance? I know I can create a stream using Bitmap.Save(), but this transcodes (and in effect - inflates) the images, even when saving a PNG back as PNG.

Or perhaps my mistake is reading them from Resource as Bitmap in the first place?

© Stack Overflow or respective owner

Related posts about c#

Related posts about system.drawing