views:

785

answers:

5

We've all seen cool WPF demo-applications with rich media.

My question is if WPF-objects can replace some basic functionality in ImageMagick. Basic functions like resizing images, cropping and so on.

The results from .NET 2.0's System.Graphics-namespace's resizing is just sad (GDI+). Maybe I'm using it wrong, but out of the box it seems to be.

Also, a good bet would be that the API:s for WPF are a bit sharper than ImageMagick's .NET APIs.

Update: My thought was that WPF maybe would have an object for Image-manipulation. Like GDI has System.Drawing.Image and System.Drawing.Bitmap. But I was hoping that WPF's object was more performant and better in quality at, for example, image-resizing.

+1  A: 

I don't know about WPF, but you could use GDI+ - there is an intro here:

Colin Pickard
GDI+ is actually used by .Net's System.Graphics namespace.
0xA3
A: 

Found this blog with something similar to your situation.

I'm a bit concerned with the fact that WPF will use hardware rendering if available. It may become a problem if you need identical results (not just looking similar) on different hardware, for example.

You can do very interesting things like applying HLSL shaders in WPF but it still looks to me as very special (and potentially problematic) way doing image processing at least now. May be someday it will become no-brainer to use WPF in many other areas but for now I would stick to more predictable ones :) Sure it's good to know that WPF is actively developed and project has people that did GDI+ (see this) but it is very fresh technology to use it in 'new ways' for serious projects. Anyway I would be glad to know if you succeed making WPF approach working for you, looks like very interesting idea to me :)

IgorK
+3  A: 

WPF and GDI+ are graphic systems designed specifically for GUI, they are not image manipulation libraries.

WPF is much better then GDI+, but it's still a GUI system - things like producing the exact same result on different hardware (like IgorK is worried about) are just not a priority and resizing quality is less important then performance - otehrwise it won't be usable as part of a rendering pipeline.

So, if you use ImageMagick for basic processing before displaying the image WPF may work for you (but I'll bet it has a lot less options then ImageMagick), if you need high quality image processing then WPF is just the wrong tool for the job.

WPF is a great GUI system (the best I've ever worked with) but it's not a general purpose graphics system and it's not an image manipulation library.

Nir
A: 

You can just use the plain old System.Drawing-namespace. Just use the correct objects, methods and paramaters and the resized images won't suck.

http://weblogs.asp.net/gunnarpeipman/archive/2009/04/02/resizing-images-without-loss-of-quality.aspx

Seb Nilsson
Thanks mate, great answer, I love you.
Seb Nilsson
A: 

Both WPF and GDI+ has lot of types of bugs when loading and processing images. I report to Microsoft some of bugs and Microsoft has been fixed this bugs now... but only in FW4.0 and Windows7. With other OS's (WinXP, Vista, Win2000) and FW2.0 this bugs will not been fixed for anytime.

-- Sorry for bad english :(

Roman Golubin