CSharp examples for System.Drawing:Image Convert
Show Image as bool array to save to a file
using System.Windows.Forms; using System.Text; using System.Linq; using System.Drawing.Imaging; using System.Drawing; using System.Collections.Generic; using System;/*from ww w . j ava 2 s . co m*/ public class Main{ internal static void ShowImage(bool[,] image) { int xsize = image.GetLength(0); int ysize = image.GetLength(1); byte[,] img = new byte[xsize, ysize]; for (int x = 0; x < xsize; x++) { for (int y = 0; y < ysize; y++) { if (image[x, y]) { img[x, y] = 255; } else { img[x, y] = 0 ; } } } ShowImage(img); } public static void ShowImage(byte[,] image) { Bitmap b = CreateBitmap(image); b.Save("image.bmp"); /*PictureBox pb = new PictureBox(); pb.Image = b; pb.Visible = true; pb.Show();*/ } }