title: Aforge Memory Usage
body: <p>I have written some c# code that needs to process upwards of about 3000 images, but by the 500th image the task manager is showing the program using 1.5gb of memory.  The function below seems to be one of the major culprits.  What could I be doing better here? Any help or suggestions are appreciated.  Thanks.</p>
  
  <pre><code>   private void FixImage(ref Bitmap field)
      {
          //rotate 45 degrees
          RotateBilinear rot = new RotateBilinear(45);
          field = rot.Apply(field);               //Memory spikes 2mb here
          //crop out unwanted image space
          Crop crop = new Crop(new Rectangle(cropStartX, cropStartY, finalWidth, finalHeight));
          field = crop.Apply(field);              //Memory spikes 2mb here
          //correct background
          for (int i = 0; i &lt; field.Width; i++)
          {
              for (int j = 0; j &lt; field.Height; j++)
              {
                  if (field.GetPixel(i, j).ToArgb() == Color.Black.ToArgb())
                      field.SetPixel(i, j, Color.White);
              }
          }                                  //Memory usuage increases 0.5mb by the end
      }
  </code></pre>