Convert Android.Graphics.Bitmap to Image

后端 未结 2 1202
礼貌的吻别
礼貌的吻别 2020-12-19 04:48

I am trying to get screenshot of the view as follows. I am getting Bitmap and I need to convert it to to Image to add into PDF generator.

using (var screensh         


        
2条回答
  •  清酒与你
    2020-12-19 05:42

    Bitmap bm = BitmapFactory.DecodeFile (path);
    MemoryStream stream = new MemoryStream ();
    bm.Compress (Bitmap.CompressFormat.Jpeg, 100, stream);
    Image img = Image.FromArray (stream.ToArray());
    

提交回复
热议问题