-
October 16th, 2003, 02:59 AM
#1
Bitmap biHeight Negative or Positive?
As I observed, most bitmaps are bottom-up DIB and the biHeight
of BITMAPINFOHEADER are positive. After scanned a bitmap,
I have to save the RGB data in a top-down way because of time issue.
So I set the biHeight negative. If I double-click the bmp file
directly, it can be shown correctly, but can't load it with ::LoadImage();
If I change biHeight to positive, I can load it with ::LoadImage(),
but the bitmap is upside-down.
Any help be appreciated.
-
October 16th, 2003, 08:39 PM
#2
???
-
October 16th, 2003, 08:41 PM
#3
Does the LoadImage fail?
Whats the error returned from GetLastError()?
Dave Mclelland.
-
October 16th, 2003, 10:04 PM
#4
VC Debug Window said:
HEAP[test.exe]: Invalid allocation size - FFF84800 (exceeded 7ffdefff)
GetLastError() returns 0x0008. That is Not enough storage is available to process this command.
My bitmap width: 658, height: 256. I think, when I set the height negative, LoadImage() still treats it as unsigned data, and gets the bitmap size by width*height. That's a too huge size.
-
October 19th, 2003, 03:10 PM
#5
Please post your call to LoadImage and any other relevant code. Post the bitmap too if possible.
Dave Mclelland.
-
October 21st, 2003, 04:19 AM
#6
Hi, Dave McLelland:
Thanks for your kindness and help.
I rearranged the bmp data in the bottom-up way, kept the height positive, and solved the problem with LoadImage.
But the problem I've mentioned above Does exist. If you still wondered, just modify any bmp to a negative height, load it with LoadImage, and I believe it will return NULL.
Anyway, if you get different result, kindly let me know please.
Regards & Thanks,
Lily311
-
February 9th, 2010, 12:50 PM
#7
Re: Bitmap biHeight Negative or Positive?
Hi All,
I'm wondering if any more light has been shed on this issue (I realize it is a very old post)? I started running into it recently pretty consistently on XP and even occasionally on Vista with very small bitmaps.
Just the normal LoadImage code:
Code:
hBitmap = (HBITMAP)LoadImage(NULL, szFileName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE);
Any insight would be helpful. Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|