views:

1913

answers:

5

Is there any alternative image manipulation library for .net? I would prefer something that is managed and open source.

I ask this because of two reasons:

  1. I have encountered hard to debug GDI+ errors with System.Drawing in the past
  2. I have read that using System.Drawing in asp.net web applications is not 100% supported.

Thanks!

edit: clarification, I know that System.Drawing can work asp.net web apps - I have used it in the past. I really just wonder if there are any managed image manipulation libraries for .net :)

A: 

With respect to (1), most of the hard to debug errors are due to not closing open handles (Dispose() in managed-land). I'm curious where you heard (2).

Nick
+1  A: 

Anecdotal evidence #1: I have used GDI+ for on-the-fly image creation within ASP.NET with no problems. I'm not sure what the problems would even be.

Chris Farmer
A: 

@Nick - (1) yes, calling dispose helps, but I still like to minimize the jumps out of managed code as much as possible...

(2) at the top of this page, in the area labeled "Caution" http://msdn.microsoft.com/en-us/library/system.drawing.aspx

Mike
+1  A: 

I don't know of any fully-managed 2D drawing libraries that are either free or open-source (there appears to be a few commercially available, but OSS is the way to go). However, you might look into the Mono bindings to Cairo.

Cairo is a platform independent 2D drawing API. You can find more information about it at the Cairo homepage. The Cairo Wikipedia page also has some good info.

Cairo is also used fairly widely in the Open Source world, which to me says something about its robustness. Mozilla, Webkit, and Mono all use it, among others. Ironically, Mono actually uses it to back their System.Drawing implementation... go figure.

There might also be a way to use Mono's System.Drawing implementation as a drop-in replacement for the Microsoft implementation, though I'm not sure how or if that would even work. I would probably start by replacing the System.Drawing.dll reference with Mono's version, and then try to deal with any errors.

Nick Aceves
+3  A: 

You should look into the WPF Imaging libraries shipped with .NET 3.0. They're optimized and robust (used to run Aero, so you know they're efficient). They don't depend on the WPF dispatcher, are easily extensible, and officially supported. What more could you want?

Frank Krueger