title: C# Base64 String to JPEG Image
body: <p>I am trying to convert a Base64String to an image which needs to be saved locally.</p>
  
  <p>At the moment, my code is able to save the image but when I open the saved image, it says "Invalid Image".</p>
  
  <p><img src="https://i.stack.imgur.com/s6aIa.png" alt="enter image description here"></p>
  
  <p>Code:</p>
  
  <pre><code>try
  {
      using (var imageFile = new StreamWriter(filePath))
      {
          imageFile.Write(resizeImage.Content);
          imageFile.Close();
      }
  }
  </code></pre>
  
  <p>The <code>Content</code> is a <code>string</code> object which contains the Base64 String.</p>