thedo#11677
I was wondering if there was an equivalent constructor to this one in the System.Drawing.Bitmap?
public Bitmap(
int width,
int height,
int stride,
PixelFormat format,
IntPtr scan0
)
in Aurigma?
My scenario is thus - In an effort to manage memory more efficiently weve been trying various techniques to minimise RAM usage, primarily by swapping things in and out of memory as much as possible (we're running into memory issues with 15Mpixel+ images).
So for example, when we want to process an image - say add a brightness filter, we
Load the Image (either from disk, or from a byte array holding the source jpeg bytes (therefore is quite small))
Process the Image (add the filters)
Copy the image to a WPF BitmapImage
Dispose of the Image
However, using the GDI+ constructor above we can load much larger images, as we can essentially map the data to a file. The Memory still shows as part of the process space, but takes up FAR FAR less private bytes (measured using Performance Counters).
So we
Load the image initially
Lock it
Copy the bytes to a file (essentially uncompressing the data to a flat file)
Discard the original image object
Call the unmanaged APIs CreateFileMapping and MapViewOfFile
Create a new System.Drawing.Bitmap object using the above constuctor, passing the result of MapViewOfFile to the scan0 parameter.
This seems to be dramatically helping our memory situation. However, Aurigma obviously has a lot of filters which we dont really want to re-implement!
Is there any way to support this scenario using Aurigma? I can see we can copy an Aurgima Bitmap to a Systm Bitmap directly, however the other way always seems to do a deep copy, which ends up loading the Aurigma version to RAM.
Any thoughts?
public Bitmap(
int width,
int height,
int stride,
PixelFormat format,
IntPtr scan0
)
in Aurigma?
My scenario is thus - In an effort to manage memory more efficiently weve been trying various techniques to minimise RAM usage, primarily by swapping things in and out of memory as much as possible (we're running into memory issues with 15Mpixel+ images).
So for example, when we want to process an image - say add a brightness filter, we
Load the Image (either from disk, or from a byte array holding the source jpeg bytes (therefore is quite small))
Process the Image (add the filters)
Copy the image to a WPF BitmapImage
Dispose of the Image
However, using the GDI+ constructor above we can load much larger images, as we can essentially map the data to a file. The Memory still shows as part of the process space, but takes up FAR FAR less private bytes (measured using Performance Counters).
So we
Load the image initially
Lock it
Copy the bytes to a file (essentially uncompressing the data to a flat file)
Discard the original image object
Call the unmanaged APIs CreateFileMapping and MapViewOfFile
Create a new System.Drawing.Bitmap object using the above constuctor, passing the result of MapViewOfFile to the scan0 parameter.
This seems to be dramatically helping our memory situation. However, Aurigma obviously has a lot of filters which we dont really want to re-implement!
Is there any way to support this scenario using Aurigma? I can see we can copy an Aurgima Bitmap to a Systm Bitmap directly, however the other way always seems to do a deep copy, which ends up loading the Aurigma version to RAM.
Any thoughts?