Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
Useful System.Drawing.Bitmap feature missing in Aurigma
Rank: Newbie
Groups: Guest
Joined: 7/16/2009(UTC) Posts: 7
|
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?
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 1/31/2005(UTC) Posts: 458
Was thanked: 5 time(s) in 5 post(s)
|
Hello,
Yes, I have to confirm that scenario with file mapping doesn't work with Graphics Mill. All our Bitmap objects are working only with buffers allocated inside Graphics Mill DLL.
The only way to apply Graphics Mill effects to such mapped bitmap is to map it part by part, convert each part to Aurigma Bitmap, transform and copy it back to mapped System.Drawing.Bitmap. It doesn't sound inspiring, but unfortunately I don't see any alternatives.
Best regards, Alex Kon |
|
|
|
|
Rank: Newbie
Groups: Guest
Joined: 7/16/2009(UTC) Posts: 7
|
Shame.
I was assuming that given you can make a System.Drawing.Bitmap based on the same block of memory as the Aurigma.GraphicsMill.Bitmap.
Unfortunately tiling wont work in my solution.
We're using WPF to display images, so using MapViewOfFile we are able to create a System.Drawing.Bitmap based on that memory chunk, and use an InteropBitmap to use the same memory chunk. By modifiying the Bitmap bits, we are able to directly modify the WPF image, as well as only store 1 copy, whereas other methods require 2 copies - a WPF copy and a GDI+ copy. The MapViewOfFile API effectively halved our bitmap memory usage - which is pretty handy with 15Mpixel+ images!
Hey ho.
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 1/31/2005(UTC) Posts: 458
Was thanked: 5 time(s) in 5 post(s)
|
Hello,
Hm, I think that maybe it is possible to create System.Drawing.Bitmap based on the same memory chunk, as Aurigma.Bitmap. But the converse is false, and that is the problem.
I'm sorry, but tiling is the only approach I can suggest.
Best regards, Alex Kon |
|
|
|
|
Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
Useful System.Drawing.Bitmap feature missing in Aurigma
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.