How to store images without taking up huge amounts of RAM

Posted by Sheeo on Stack Overflow See other posts from Stack Overflow or by Sheeo
Published on 2010-03-15T23:47:23Z Indexed on 2010/04/06 13:33 UTC
Read the original article Hit count: 318

Filed under:
|
|
|

I'm working on a silverlight project where users get to create their own Collages.

The problem

When loading a bunch of images by using the BitmapImage class, Silverlight hogs up huge unreasonable amounts of RAM. 150 pictures where single ones fill up at most 4,5mb takes up about 1,6GB of RAM--thus ending up throwing memory exceptions.

I'm loading them through streams, since the user selects their own photos.

What I'm looking for

A class, method or some process to eliminate the huge amount of RAM being sucked up.

I've tried using a WriteableBitmap to render the images into, but I find this method forces me to reinvent the wheel when it comes to drag/drop and other things I want users to be able to do with the images.

© Stack Overflow or respective owner

Related posts about c#

Related posts about Silverlight