把bitmap转换为base64的数据流。

bitmap有一个Save重载方法,传入Stream和图片格式即可。

 

bitmap to base64

System.Drawing.Bitmap bitMap = getbitmap();

            System.IO.MemoryStream ms = new System.IO.MemoryStream();

            bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            byte[] bytes = ms.ToArray();

            Convert.ToBase64String(bytes);
Source Code

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2022-12-23
  • 2021-06-26
  • 2021-09-01
猜你喜欢
  • 2022-12-23
  • 2022-02-16
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2022-03-03
相关资源
相似解决方案