[Algorithms] OT: How to read a bitmap of arbitrary size?
Brought to you by:
vexxed72
From: Pai-Hung C. <pa...@ac...> - 2000-08-13 17:03:14
|
Hi, I have been frustratingly bugged for hours and I decide to resort to the list. I want to read a 24-bit bitmap heightfield. I can correctly read it as long as the dimension of the bitmap file is in 2's power such as 4x4, 8x8, 16x16, etc. (But 2x2 doesn't work?!) In these _normal_ cases, the *biSizeImage* field of the BITMAPINFOHEADER structure gives me the correct size of image in bytes. However, if I create a bitmap of non-2's-power dimension such as 5x5, 6x6, 7x7, etc., the *biSizeImage* field gives me some bogus number. For example, 5x5 yields 80 bytes (5x5x3 = 75 bytes); 6x6 yields 120 bytes (6x6x3 = 108 bytes); 7x7 yields 168 bytes (7x7x3 = 147 bytes). Could somebody tell me what happened? Thanks in advance, Pai-Hung Chen |