Click to See Complete Forum and Search --> : GDI+ Bitmap size limitation?


Metaspace
December 1st, 2006, 08:10 AM
It seems that bitmaps of the GDI+ Bitmap class are limited to a size of 32767 pixels in either direction (width, height).
I use Visual C++ 6.0 with latest patch, plus Platform SDK.

This limit is not documented, and I have not found anything on the topic on the net; all I did find was that GDI+ is supposed to overcome any previous short-int limitations (e.g., GDI display surface).

In the attached demo application (see CTest_bmpView::OnDraw), if 32768 or a larger value is used for the width or height of the GDI+ bitmap, although creation of the bitmap and operations on it (e.g., FillRectangle) are successful, display (using Graphics::DrawImage) or saving (Bitmap::Save) fail, with status code InvalidParameter and Win32Error, respectively.
Additional error information obtained using ::GetLastError is useless ("Operation Successful").

Has anyone encountered this problem, or even better, knows how to overcome it? Would also appreciate the odd report of reproducibility.

Metaspace
December 4th, 2006, 12:02 PM
I'd also be interested whether anyone can reproduce this problem with a newer environment, e.g., DevStudio 200X.

Thanks in advance!

Metaspace
February 5th, 2007, 04:25 AM
Anyone?

Xiphias
February 14th, 2007, 07:25 AM
That's a pretty big bitmap...
i think you're right in that it might be limited to a signed short in either direction.
which limits the maximum size of a bitmap to slightly below 24 gigabytes.

32767 * 32767 * 24 (bits pr pixel) = 25768230936 bytes
25768230936 / 1024^3 = 23.998535

now I'm not saying you'll never need that big bitmaps, i'm just saying that if you need a bitmap that big, you'll probably need to implement it yourself..

just out of curiousity, what are you using it for?

Metaspace
February 14th, 2007, 07:40 AM
Nobody spoke of using a bitmap with size 2^15 X 2^15;

I need to display some wich may be up to a few tens of thousands of pixels high (displayed in a scrollable view), but only a few dozen pixel wide.
Used for some exotic legends in map display.

Of course there are workarounds (which I do find awkward, especially after Microsoft boasted about overcoming 16bit limitiations with GDI+)

Thx for answering,

-Metaspace