开发者

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
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜