tags:

views:

2714

answers:

4

Is it possible to do image processing in silverlight 2.0?

What I want to do is take an image, crop it, and then send the new cropped image up to the server. I know I can fake it by clipping the image, but that only effects the rendering of the image. I want to create a new image.

After further research I have answered my own question. Answer: No. Since all apis would be in System.Windows.Media.Imaging and that namespace does not have the appropriate classes in Silverlight

I'm going to use fjcore. http://code.google.com/p/fjcore/

Thanks Jonas

+2  A: 

I know this doesn't directly answer your question, but what if you do all of the clipping on the client side to crop the image, then send the server the original image and the coordinates for clipping. Then on the server side, which will probably more suited for image manipulation like this (e.g. PHP it's very easy) you'll do the actual cropping of the image and storing the cropped version.

Daniel Jennings
we are currently implementing this as plan B. it would be nice to do the processing on the client though, it would save lots of resources.
Brian Leahy
A: 

@ Daniel that will be plan B :) I'm hoping to use the client's processing power though.

Brian Leahy
+3  A: 

Well, you can actually do local image processing in Silverlight 2... But there are no built in classes to help you. But you can load any image into a byte array, and start manipulating it, or implement your own image encoder.

Joe Stegman got lots of great information about "editable images" in Silverlight over at http://blogs.msdn.com/jstegman/. He does things like applying filters to images, generating mandlebrots and more.

This blog discuss a JPEG Silverilght Encoder (FJCore) you can use to resize and recompress photos client size: http://fluxcapacity.net/2008/07/14/fjcore-to-the-rescue/

Another tool is "Fluxify" which lets you resize and upload photos using Silverilght 2. Can be found over at http://fluxtools.net/

So yes, client side image processing can definetly be done in Silverilght 2. Happy hacking!

Jonas Follesø
+1  A: 

There is first-class support for bitmap surfaces in Silverlight 3: http://blogs.msdn.com/kaevans/archive/2009/03/20/some-silverlight-3-goodness-using-writeablebitmap.aspx

Jason Prado
bummer, they scrapped silverlight for that project.
Brian Leahy