Maybe the palette should have 256 entries?
The following should work:
I have added this as a unit test.
The following should work:
[Test] publicvoid Discussion453825() { var data = newbyte[100 * 100]; int k = 0; for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { data[i + (j * 100)] = (byte)(k++ % 256); } } var palette = OxyPalettes.Gray(256).Colors.ToArray(); var im = OxyImage.FromIndexed8(100, 100, data, palette); File.WriteAllBytes("Discussion453825.bmp", im.GetData()); }