Parameter is not valid error when creating image from byte[] in c#

前端 未结 4 1930

I am trying to convert a byte[] to Bitmap in c#. Following is the code:

MemoryStream ms = new MemoryStream(b);
Bitmap bmp = new Bit         


        
4条回答
  •  一整个雨季
    2020-12-05 21:39

    Try resetting current location in the stream

    MemoryStream ms = new MemoryStream(b);
    ms.Seek(0, SeekOrigin.Begin);
    Bitmap bmp = new Bitmap(ms);
    

提交回复
热议问题