private static void SaveImage(ushort[] pixels, int width, int height) { var greyPixels = new Gray <ushort> [height, width]; for (var y = 0; y < height; y++) { for (var x = 0; x < width; x++) { greyPixels[y, x] = pixels[y * width + x]; } } var filename = GetNextImageFilename(); greyPixels.Save(filename); Console.WriteLine("Saved image"); }
private static string SaveImage(ushort[] pixels, int width, int height) { var greyPixels = new Gray <ushort> [height, width]; for (var y = 0; y < height; y++) { for (var x = 0; x < width; x++) { greyPixels[y, x] = pixels[y * width + x]; } } var fileName = "image.png"; greyPixels.Save(Path.Combine(_windowsFileDir, fileName)); return(fileName); }