Facebook
From Toxic Marten, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 245
  1. for (int i = 0; i < img.Width; i++)
  2.             {
  3.                 for (int j = 0; j < img.Height; j++)
  4.                 {
  5.  
  6.                     Color k = img.GetPixel(i, j);
  7.                     int a = k.GetHashCode();
  8.                     String s = Convert.ToString(a, 2).ToString();
  9.                     if (kk > by.Length - 1)
  10.                     {
  11.                         s = s.Remove(s.Length - 1, 1) + "0";
  12.                     }
  13.                     else if (by.ElementAt(kk) == '0')
  14.                     {
  15.                         s = s.Remove(s.Length - 1, 1) + "0";
  16.                     }
  17.                     else if (by.ElementAt(kk) == '1')
  18.                     {
  19.                         s = s.Remove(s.Length - 1, 1) + "1";
  20.                     }
  21.                     int x = Convert.ToInt32(s,2);
  22.                     Color c = Color.FromArgb(x);
  23.                     img2.SetPixel(i, j, c);
  24.                     kk++;
  25.                 }
  26.             }