Is there a way to access the underlying memory of a BitmapImage
object with c# pointers?
I know that there's a CopyPixels
method but it makes a copy of the pixels array into a new array (duplicating memory requirements). If you open a large image (2gb) it allocates a lot of un-useful stuff. And if you want to operate some sort of elaboration, like CCLA, it takes a huge amount of memory.
I need only to read the pixel array.
Is it possible to address pixels directly like you can do in System.Drawing.Bitmap
?
I wrote a fast bitmap access for System.Drawing.Bitmap
, but as I'm using WPF, I need the same functionality for BitmapSource
. Otherwise I have to duplicate the image loading (Bitmap for my old method and BitmapSource
to show the image in WPF) taking a lot of memory and time.
Thank you Lorenzo