Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Drawing;
- using System.IO;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Bitmap bitmap = new Bitmap("puzzle.png");
- BitArray b = new BitArray(8);
- byte[] bytes = new byte[1];
- string output = "";
- for (int i = 0; i<bitmap.Height; i++)
- {
- for (int j = 0; j<bitmap.Width; j++)
- {
- b.Set(j % 8, bitmap.GetPixel(j, i).A == 254);
- if (j % 8 == b.Length-1)
- {
- b.CopyTo(bytes, 0);
- output += Encoding.ASCII.GetString(bytes);
- }
- //Console.Write(bitmap.GetPixel(j, i).A==254 ? 0 : 1);
- //Console.Write(",");
- }
- //Console.WriteLine();
- }
- Console.WriteLine(output);
- File.WriteAllText("output.txt",output);
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment