Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top