title: Loop through a folder containing images, resize images and place in new folder
body: <p>I have the following code that simple grabs a specific image and provide a fixed size regardless of the original size. This is the desire action.</p>
  
  <p>The problem is, I must select each image from the source folder 1 at a time.</p>
  
  <p>I need to loop though the Source folder, resize each image and then save the image in a destination folder. I am familiar with looping for files but not necessarily images.</p>
  
  <p><em>Code:</em></p>
  
  <pre><code>class Program
  {
      public static Image ScaleImage(Image image, int maxWidth, int maxHeight)
      {
          var newImage = new Bitmap(maxWidth, maxHeight);
          using (Graphics graphics = Graphics.FromImage(newImage))
          {
              graphics.CompositingQuality =
             System.Drawing.Drawing2D.CompositingQuality.HighQuality;
              graphics.InterpolationMode =
              System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
              graphics.SmoothingMode =
              System.Drawing.Drawing2D.SmoothingMode.HighQuality;
              graphics.DrawImage(image, 0, 0, maxWidth, maxHeight);
          }
  
          return newImage;
  
      }
  
      static void Main(string[] args)
      {
          var image = Image.FromFile(@"C:\Source\original_image.jpg");
          var newImage = ScaleImage(image, 150, 150);
          newImage.Save(@"C:\Dest\resized_image.png", ImageFormat.Png);
      }
  }
  </code></pre>