Jose Saiz

Jose Saiz

  • 1.5k
  • 260
  • 103.1k

Help loading base64 into an Image Control in c#

Apr 2 2021 5:14 PM
Hi Guys can any one tell me why this is not working, I am trying to load a base64 string to a windows form Image control .
 
this my code
  1. var binaryData = System.Text.Encoding.Unicode.GetBytes("iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAN7SURBVHjajFXbSxRRGD9z5szs7FUxTe1uIohilhTRg6KxvWZv9RI9RATRn9BTPUaSb9Wz0ENYQhBdWKjAIKyHggiKblqpq5mb7jqXc+k7u7Pr7Lizu4eZ2dlz+b7f9/t93zdKMjmMEUIK8g+BhCCIr7e3DFrxWD8xrcXE7MIDTBlHirJ1f+Uhisa9t4DzTGWcr3a0jKZ799/kGmnP7Gk7v9TbeRULxME8k3v8t2u0zB7xe4RBLMs+jhlfNePbTjR+nb/T8uHL7fX25p7lvs5xU4hunrO7IQp5wYGCURj/dF17AXPCywjJk7E5wXI56wpnvEPH6BnsBTqQ/evYgbHwSiaFHZbhnO9kjA+gcpZgmnfBfH80aowBSLVok3iMC4mGc9YTiYYv6wgtrefM2Nqu1osK5zSaXrkPy5FQSE9hjaR8DhCldB+AuybckLwRlEbhjGLDIywKLpf1teyTps9zk/DHEirOIwMbWErlOUdhLgSvtl9lHKC+Iq04sUiS5DayDbML77mmRcAkAdbEllQRJXG3jDINvOFBKqH4z/TE4qGuW99HBlqthsQRYzU9hSlFQiWVjIkgB57NymYREILii3+m1Tf8VLataSi6PPcwNr/8HKlEpgytFHWQA58G+ZxzbNs5DFnRhWcXzPiP+TRMJxwVn7a3FpmiqvgjxspaTQdulCLPFueNkHo78lK6NiWFipdG9wHGf8OmTB0aFBDBL8FG+JMGxYbqaArgYEFQJ1yvBgBTcShHQ9RhR2t1HYlJJ+pLyN939WoABSx0HTmPQedXZZYCnGHEM5C87XVrAI4s26YnHYcOBaWfF5emkaeaps7UdCAKxSk1CIVC2iQcfFRPTwYNcpBxe+ulSCK2TNM+4zhsuKiBTADPO/YGJoHoOpmug6KS0oZh6BO6Lu55RXadyN7vuC3aKa4xxnZXUsnXrksamBDBWdBgpDhZ7P2qqr6Fljye74o2PWhZzgVYCUONNANVf6umqauBLKgQRHAXdJiqEKBELbsqM03rOqUs6S5YiUR0UIYlhFCqpylcgGYD9pkBFBYLOiI7B1R8FgCNghYz8otYJYvyp2RfZ1U6pJcyLM8YRugc0JbyG/c7kNEBx/h1NrsxhjFOB5dW4eMNyLcD8kvRaHjS/UwG9qJSSkcixg3gtQ8ORGrlPwAaI0T9BntxUMT/BRgArXyoqkkA96AAAAAASUVORK5CYII=");  
  2. Image imgView = Image.FromStream(new MemoryStream(binaryData));  
  3.                   
 I keep getting this error message -2147024809 - Message=Parameter is not valid.
NameValueType
$exception{"Parameter is not valid."}System.ArgumentException
 
Thanks for your inputs 

Answers (2)