Image.FromFile starts 'skipping' files
<p>I'm loading a bunch of files into a <code>ListView</code>, and I use <code>Image.FromFile()</code> and <code>.Width</code> and <code>.Height</code> to display the the resolution of each file in a designated column. However, whenever I load more than a handful of files, this method starts skipping files. The first, say 50 files are all loaded properly but after that more and more files are skipped.</p>

<p>What could cause this problem, and are any better alternative methods available? This method also slows down the loading process considerably, so hopefully this process can be sped up a little bit.</p>

<p>EDIT: Sorry... Here's the relevant code:</p>

<pre><code>private void AddItem(string file)
{
     FileInfo fi = new FileInfo(file);
     ListViewItem item = new ListViewItem(fi.FullName);

     try
     {
          Image img = Image.FromFile(fi.FullName);
          item.SubItems.Add(string.Format("{0} x {1}", img.Width, img.Height));
     }

     catch { }

     ((ListView)sender).Items.Add(item);
</code></pre>

<p>}</p>

<p>The try/catch methods are meant to prevent errors for non-image files. However, they also seem to be 'responsible' for the skipping issue. When I disable them I get an 'out of memory' error, which seems to be the real cause here.</p>
