Showing posts with label System.Drawing. Show all posts
Showing posts with label System.Drawing. Show all posts

Wednesday, November 14, 2007

System.Drawing.Image.Save() results in ArgumentException: "Parameter is not valid"

If you are using the .NET Image.Save() method to save an image, and you receive an ArgumentException with the message "Parameter is not valid," you probably spent a while examining the parameters you were passing into the Save() call, right? You probably banged your head against the wall and said, "Dear GOD, please tell me WHICH PARAMETER is not valid!"

Unfortunately, the error message is completely unhelpful, and you are seeing it because you had a brain fart. You have called Dispose() on the image object before you tried to Save() it.

If this helps you, please comment on this post, thanks.