Is there any way to create a more space/resource efficient bitmap? Currently I try to render a file, approx 800px high but around 720000px wide. It crashes my application, presumably because of the share memory-size of the bitmap.
Can I do this more efficiently, like creating it as an gif directly and not later when I save it?
I try to save a series of lines/rectangles from a real world reading, and I want it to be 1px per 1/100th of a second.
You have to remember that any image you load into memory regardless if it's a GIF or JPEG or whatever on disk will be turned into a 32 bit bitmap which means four bytes per pixel.
This means that the image you're creating will be:
4 bytes * 800 pixels high * 720,000 pixels wide = 2,304,000,000 bytes
You're basically blowing your memory by trying to create an image that large.
For whatever you're trying to accomplish the answer is tiling and caching your image.
Your image is about 2.3 gig, and the biggest .Net object you can have is 2 gig regardless if the machine is 32 or 64 bit.
You're going to have to break the bitmap up in chunks to handle an image that size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With