title: Parameter is not valid error on bitmap constructor
body: <p>I know, I know... there are many others posts like this. I didn't find what I was look for, let's move on.</p>
  
  <p>I break a PDF into images using <a href="https://github.com/mephraim/ghostscriptsharp" rel="nofollow">this GhostScript implementation for C#</a> and then try to load each image into a Bitmap, sometimes it gives me a <code>Parameter is not valid error</code> on this line:</p>
  
  <pre><code>[...]new Bitmap((Image)Image.FromFile(imagePath))[...]
  </code></pre>
  
  <p><br>
  <code>Image.FromFile(imagePath)</code> successfully returns an Image (though I think it's returning a Bitmap) but then Bitmap's constructor gives me the error. What am I doing wrong?</p>
  
  <p>P.S.<br>
  I'm casting the result to <code>Image</code> because when I quick watch the result of Image.FromFile(...) it shows it as a System.Drawing.Bitmap (either way, cast, no cast, yields the same result).</p>