Search code examples
silverlight-4.0writeablebitmap

How can i convert WriteableBitmap to jpg or some other common format?


I have one application that allows user to do various things like rotating and scaling an image and finally when the user clicks on save, the image should get saved on the server. Everything works out fine but the problem is since I am directly saving the WriteableBitmap after converting it to bytearray using WriteableBitmapEx, the saved image is also WriteableBitmap and so I am not able to view it using common Picture Viewer.

I want my image to be saved as a JPEG. How can I do this?


Solution

  • Hey Ankit, here is a sample by John Papa that shows how to save WriteableBitmaps to PNG's.

    http://johnpapa.net/silverlight/saving-snapshots-to-png-in-silverlight-4-and-the-webcam/

    He uses two options: http://imagetools.codeplex.com/

    And: http://blogs.msdn.com/b/jstegman/archive/2008/04/21/dynamic-image-generation-in-silverlight.aspx

    I would suggest the ImageTools route.