Hello I have an array with a bunch of grayscale values
var test="...0,222,254,254,254,254,241,198,198,198,198,198,198,198,198,170,52...".Split(',');
And I want to create a bitmap with those values
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++;
}
However when I try to save it to disk:
bmp.Save(@"E:\r\0.jpg",ImageFormat.Jpeg);
I get the Generic GDI+ error
I have tried
Checking file permissions
Changing ImageFormat
Cloning the bitmap