title: Comparing two base64 image strings and removing matches?
body: <p>Not sure if what I'm trying to do will work out, or is even possible. Basically I'm creating a remote desktop type app which captures the screen as a jpeg image and sends it to the client app for displaying.<br>
  I want to reduce the amount of data sent each time by comparing the image to the older one and only sending the differences. For example:</p>
  
  <pre><code>var bitmap = new Bitmap(1024, 720);
  
  string oldBase = "";
  
  using (var stream = new MemoryStream())
  using (var graphics = Graphics.FromImage(bitmap))
  {
      graphics.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size);
      bitmap.Save(stream, ImageFormat.Jpeg);
      string newBase = Convert.ToBase64String(stream.ToArray());
  
      // ! Do compare/replace stuff here with newBase and oldBase !
  
      // Store the old image as a base64 string.
      oldBase = newBase;
  }
  </code></pre>
  
  <p>Using something like this I could compare both base64 strings and replace any matches. The matched text could be replaced with something like: </p>
  
  <blockquote>
    <p>[number of characters replaced]</p>
  </blockquote>
  
  <p>That way, on the client side I know where to replace the old data and add the new. Again, I'm not sure if this would even work so anyones thoughts on this would be very appreciated. :) If it is possible, could you point me in the right direction? Thanks.</p>