Try the following:
public static Stream ToStream(this Image image, ImageFormat format) { var stream = new System.IO.MemoryStream(); image.Save(stream, format); stream.Position = 0; return stream; }
Then you can use the following:
var stream = myImage.ToStream(ImageFormat.Gif);
Replace GIF with any format suitable for your scenario.
JaredPar Nov 03 '09 at 16:32 2009-11-03 16:32
source share