See the question and my original answer on StackOverflow

About the "GDI+ generic error" and the "Out Of Memory" exceptions, you should take a look at that link on SO: What is the "best" way to create a thumbnail using ASP.NET?

You must use the C# using statement to make sure unmanaged GDI+ resources underneath the .NET surface are freed as quickly as possible to avoid out of memory errors.

The GDI+ generic can happen if the image cannot be converted for example.