views:

127

answers:

1

Given a WriteableBitmap, how can I save the bitmap back into an image stream (JPG or BMP)?

My scenario is:

  1. Show OpenFileDialog, let user select image
  2. Load image into WriteableBitmap
  3. Resize image
  4. Send image stream to web service

Step #4 is what I'm having trouble with. How can I go from WriteableBitmap -> Stream?

A: 

Ok, so Silverlight doesn't have anything built-in to turn a WriteableBitmap into an image stream.

After much wailing and gnashing of teeth, I found the excellent open source ImageTools library for Silverlight, which provides encoders and decoders for JPG, BMP, GIF, and PNG.

Judah Himango