views:

20

answers:

1

For the images in my application, I have been setting the source property of my image to a JPEG file on disk but, as part of my next iteration, I want to test keeping them in memory for speed.

How do I tell the WPF Image control to get its information from an in-memory source rather than from a file?

+1  A: 

Have a look at InteropBitmap and WriteableBitmap, two classes that inherit from BitmapSource that allow you to supply the pixels of the image from an array.

To create an InteropBitmap you use methods on the Imaging class like Imaging.CreateBitmapSourceFromMemorySection.

Samuel Jack