All System.Drawing classes have memory leaks and threading bugs that have to be manually fixed. We maintain a (partial) list of the known pitfalls here, and we expose a plugin API that minimizes risk. If not, please allow ImageResizer to handle the entirety of the imaging process.
#WITH ASP.NET 40 IN THE LIST OF IIS WEB SERVER EXTENSIONS PROFESSIONAL#
If you have a professional background in C++, the Windows API, imaging, and verify all System.Drawing methods with ILSpy, you can consider using System.Drawing yourself. Call void Build(source,destination,settings) instad of Bitmap Build(source, settings). Never use System.Drawing directly from your code. Remove the System.Drawing assembly from your project References, when possible.It's worth investing a couple minutes to locate the right ImageResizer plugin for your data store instead of writing your own MVC action. Application frameworks like MVC and WebAPI are not designed for large binary payloads, and (really) don't need to be. These are fundamental limitations of HttpHandlers compared to HttpModules. When wrapped inside an MVC Action, HttpHandler, or WebAPI action, ImageResizer is unable to integrate with IIS, perform disk caching, support plugins, link to data stores efficiently, or provide advanced HTTP responses. As a pipeline, ImageResizer can handle high loads and disk cache millions of images. When serving images, use ImageResizer as a pipeline, not as a library.