Getting an Image object from a byte array

前端 未结 4 1192
Happy的楠姐
Happy的楠姐 2021-02-07 08:37

I\'ve got a byte array for an image (stored in the database). I want to create an Image object, create several Images of different sizes and store them back in the database (sa

4条回答
  •  心在旅途
    2021-02-07 09:01

    You'd use a MemoryStream to do this:

    byte[] bytes;
    ...
    using (var ms = new System.IO.MemoryStream(bytes)) {
       using(var img = Image.FromStream(ms)) {
          ...
       }
    }
    

提交回复
热议问题