title: Conversion of PNG image to base64 in Windows phone7.1
body: <p>I want to convert a PNG image found in a path to base64 for a html page in Windows phone7.1.How can it be done?</p>
  
  <pre><code>        Stream imgStream;
          imgStream =   Assembly.GetExecutingAssembly().GetManifestResourceStream("NewUIChanges.Htmlfile.round1.png");
          byte[] data = new byte[(int)imgStream.Length];
          int offset = 0;
          while (offset &lt; data.Length)
          {
              int bytesRead = imgStream.Read(data, offset, data.Length - offset);
              if (bytesRead &lt;= 0)
              {
                  throw new EndOfStreamException("Stream wasn't as long as it claimed");
              }
              offset += bytesRead;
          }
  </code></pre>