Miles_Mei 2018-08-16 13:46 采纳率: 80%
浏览 1657
已采纳

vb.net怎么从内存中读取bmp图片?

写入内存的参考代码如下,读取的图片为外界写入内存中的,请问要怎么实现?

  Dim bmpData As System.Drawing.Imaging.BitmapData = bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, bmp.PixelFormat)
            ' Get the address of the first line.   

            sdkimage._height = bmp.Height       ' 图片高度
            sdkimage._width = bmp.Width          ' 图片宽度
            sdkimage.data = bmpData.Scan0         '   位图中第一个像素数据的地址
            sdkimage._size = bmpData.Stride * bmp.Height   '数据大小
  • 写回答

1条回答 默认 最新

  • threenewbee 2018-08-16 14:50
    关注
     Dim bytes() As Byte = ...
    Dim ms1 As MemoryStream = new MemoryStream(bytes)
    Dim bm As Bitmap = CType(Image.FromStream(ms1), Bitmap)
    ms1.Close() 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?