C#: How to convert BITMAP byte array to JPEG format?

后端 未结 3 1875
孤街浪徒
孤街浪徒 2020-12-06 09:16

How can I convert a BITMAP in byte array format to JPEG format using .net 2.0?

3条回答
  •  既然无缘
    2020-12-06 10:02

    If it is just a buffer of raw pixel data, and not a complete image file(including headers etc., such as a JPEG) then you can't use Image.FromStream.

    I think what you might be looking for is System.Drawing.Bitmap.LockBits, returning a System.Drawing.Imaging.ImageData; this provides access to reading and writing the image's pixels using a pointer to memory.

提交回复
热议问题