title: c# hex string to byte image and filtering
body: <p>I need some help in converting a hex string into an image  </p>
  
  <p>doing some researches i came up to this code:  </p>
  
  <pre><code>private byte[] HexString2Bytes(string hexString)
  {
      int bytesCount = (hexString.Length) / 2;
      byte[] bytes = new byte[bytesCount];
      for (int x = 0; x &lt; bytesCount; ++x)
      {
          bytes[x] = Convert.ToByte(hexString.Substring(x*2, 2),16);
      }
  
      return bytes;
  }
  
  
  public bool ByteArrayToFile(string _FileName, byte[] _ByteArray)
  {
      try
      {
              System.IO.FileStream _FileStream = new  System.IO.FileStream(_FileName, System.IO.FileMode.Create, System.IO.FileAccess.Write);
              _FileStream.Write(_ByteArray, 0, _ByteArray.Length);
              _FileStream.Close();
              return true;
       }
       catch (Exception _Exception)
       {
           MessageBox.Show(_Exception.Message);
       }
  
          return false;
   }
  </code></pre>
  
  <p>The problem is that the resulting image is almost all black and i guess i need to apply some filters to better translate the gray-scale (since the original image is in gray-scale only)  </p>
  
  <p>Can anyone help me?  </p>
  
  <p>Many thanks</p>