title: Pixel by Pixel color conversion using WriteableBitmap
body: <p>I am working on a windows application.</p>
  
  <p>I want to do a pixel by pixel color change of a PNG from black to white.PNG has a transparent background.</p>
  
  <p>For this purpose, I have written a little function, that looks like this:</p>
  
  <pre><code>public void colorImageChange()
  {
      byte a = 255;
      StreamResourceInfo sri = Application.GetResourceStream(new Uri("Assets/Picto_1604_Panther_Black.png", UriKind.Relative));
      BitmapImage src = new BitmapImage();
      src.SetSource(sri.Stream);
  
      // Get WriteableBitmap
      WriteableBitmap bitmap = new WriteableBitmap(src);
  
      for (int x = 0; x &lt; bitmap.Pixels.Length; x++)
      {
          byte[] actualColorValues = BitConverter.GetBytes(bitmap.Pixels[x]);
          byte[] modifiedColorValues = new byte[4];
  
          modifiedColorValues[0] = a;
          modifiedColorValues[1] = a;
          modifiedColorValues[2] = a;
          //modifiedColorValues[3] = a;
  
          //opacity
          modifiedColorValues[3] = actualColorValues[3];
  
          bitmap.Pixels[x] = BitConverter.ToInt32(modifiedColorValues, 0);
      }
      // Set Image object, defined in XAML, to the modified bitmap.
      ImageViewer1.Source = bitmap;
  }
  </code></pre>
  
  <p>I am able to change the color of image but my Problem is, that the edges of image are not smooth. 
  I am attaching the expected image (to left) and the output image (to right).</p>
  
  <p><a href="https://i.stack.imgur.com/FSvg0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FSvg0.png" alt="enter image description here"></a>        <a href="https://i.stack.imgur.com/E03id.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E03id.png" alt="enter image description here"></a></p>