C#中的Format16bppGrayScale格式的图片有什么特殊吗,怎么保存 呢

byte[] rgbs = new byte[500 * 500];
IntPtr hglobal = IntPtr.Zero;
addWithCuda(data_cal,line,startt, cut_arraysize, biaoding, rgb, aa, bb, minn_gray, maxx_gray, color_gray,outt);

Bitmap myBMP;
string final_name = pathString + "\" + k3.ToString() + ".bmp";
rgbs里面存的是加了色调的数据
System.Runtime.InteropServices.Marshal.Copy(rgbs, 0, hglobal, rgbs.Length);
myBMP = new Bitmap(line, 500, 500*2, System.Drawing.Imaging.PixelFormat.Format16bppGrayScale, hglobal);
myBMP.Save(final_name, System.Drawing.Imaging.ImageFormat.Bmp);
在保存时出错,说是GDI的一般性错误

发生这个错误是你保持格式不对
具体的我也忘了 反正应该有另外一个类

好像要用到graphic 类 把图像放到这个类里面 然后再保持 我的空间有相关文章 你去找下吧