I would like to convert simple picture to byte array and then save this array to .txt I tried to do this but I'm lost.. I can't convert this ... I would like to have array and at the place where are figures in my array should appear 1. If there is nothing should be 0.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Image image = Image.FromFile(@"D:\Stackimage\1.png");
var ms = new MemoryStream();
image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
var bytes = ms.ToArray();
string[] tab = new string[1000000];
for (int i = 0; i < 1000000; i++)
{
tab[i] = "" + bytes;
}
MessageBox.Show("start");
using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"D:\data.txt"))
{
foreach (string elem in tab)
{
writer.WriteLine(elem);
}
}
MessageBox.Show("stop");
}
I add here my image. My picture