0
你好,我有一大堆的灰度值創建位圖(從一組灰度值),並將其保存到磁盤 - GDI +一般性錯誤
var test="...0,222,254,254,254,254,241,198,198,198,198,198,198,198,198,170,52...".Split(',');
的數組,我想創建與位圖值
int c = 1;
var bmp = new Bitmap(28, 28);
for (int i = 0; i < 28; i++)
for (int j = 0; j < 28; j++)
{
bmp.SetPixel(i, j, Color.FromArgb(Convert.ToInt32(test[c]), Convert.ToInt32(test[c]), Convert.ToInt32(test[c])));
c++;
}
然而,當我嘗試將其保存到磁盤:
bmp.Save(@"E:\r\0.jpg",ImageFormat.Jpeg);
我得到的通用GDI +錯誤
我已經試過
檢查文件權限
更改的imageformat
克隆位圖
http://stackoverflow.com/questions/2265910/c-convert-image-to-grayscale –