title: resizing all the images in a file folder
body: <p>I am trying to resize all the images that are found in the same file folder to the same size. Here is the code I have but it is not working. A little help please (Ignore "CombineImages(files);" that is another method of the program that is working just fine)</p>
  
  <pre><code>    private void cmdCombine_Click(object sender, EventArgs e)
      {
          //Change the path to location where your images are stored.
          DirectoryInfo directory = new DirectoryInfo(@"C:\Users\Elder Zollinger\Desktop\Images");
          if (directory != null)
          {
              FileInfo[] files = directory.GetFiles();
              ResizeImages(files);
              CombineImages(files);
          }
  
      private void ResizeImages(FileInfo[] files)
      {
          foreach (FileInfo file in files)
          {
              Image img = Image.FromFile(file.FullName);
              var newImage = ScaleImage(img, 200, 400);
          }   
      public static Image ScaleImage(Image image, int maxWidth, int maxHeight)
      {
          var ratioX = (double)maxWidth / image.Width;
          var ratioY = (double)maxHeight / image.Height;
          var ratio = Math.Min(ratioX, ratioY);
  
          var newWidth = (int)(image.Width * ratio);
          var newHeight = (int)(image.Height * ratio);
  
          var newImage = new Bitmap(newWidth, newHeight);
          Graphics.FromImage(newImage).DrawImage(image, 0, 0, newWidth, newHeight);
          return newImage;
      }
  </code></pre>