title: Create Image Mask
body: <p>The user provides my app an image, from which the app needs to make a mask:</p>
  
  <p><img src="https://i.stack.imgur.com/XGaJf.png" alt=""></p>
  
  <p>The mask contains a red pixel for each transparent pixel in the original image.</p>
  
  <p>I tried the following:</p>
  
  <pre><code>Bitmap OrgImg = Image.FromFile(FilePath);
  Bitmap NewImg = new Bitmap(OrgImg.Width, OrgImg.Height);
  for (int y = 0; y &lt;= OrgImg.Height - 1; y++) {
      for (int x = 0; x &lt;= OrgImg.Width - 1; x++) {
          if (OrgImg.GetPixel(x, y).A != 255) {
              NewImg.SetPixel(x, y, Color.FromArgb(255 - OrgImg.GetPixel(x, y).A, 255, 0, 0));
          }
      }
  }
  OrgImg.Dispose();
  PictureBox1.Image = NewImg;
  </code></pre>
  
  <p>I am worried about the performance on slow PCs. Is there a better approach to do this?</p>