Monodroid bitmap to stream
does any one know how to turn a bitmap into a stream on monodroid?开发者_如何学Go I'm creating a bitmap from a url stream then resizing that bitmap so I can store it on a file for later use.
thank you
If you're talking about Android.Graphics.Bitmap, you could use Bitmap.Compress(CompressFormat, Stream) to write the Bitmap
contents to a Stream.
This is what JonP was referring to. Of course you can select whatever format you'd like.
using (MemoryStream stream = new MemoryStream())
{
if (bmp.Compress(Bitmap.CompressFormat.Jpeg, 80, stream))
{
//do whatever needed with stream
}
}
精彩评论