Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Things in bitmap header don't add up

0 views
Skip to first unread message

soxmax

unread,
Jul 26, 2007, 6:32:43 PM7/26/07
to
I am trying to create an image analysis routine. I am looking at an
image with a resolution of 930 X 768. When I read the bitmap header it
tells me:

biWidth = 930
biHeight = 768
biBitCount = 8
biCompression = 0
biSizeImage = 715776 <---- HUH?

Now, I'll be the first to admit that I suck at math but it seems to me
the size should be 930 X 768 = 714240. If I add two to the width I get
932 X 768 = 715776.

In fact.. if I run the image data through StretchDiBits with a source
width and height of 930 X 768 I get a few diagonal lines and a skewed
image. If I do the same thing after setting the width to 932 I get two
pixels on the right side of each line set to black. My analysis
routine must be able to deal with any resolution image. Are there
certain resolutions that imaging software compensates for? What are
these weird resolutions? Does anyone have any experience with this
issue?

Jan Ringoš

unread,
Aug 2, 2007, 3:07:15 PM8/2/07
to
Dne Fri, 27 Jul 2007 00:32:43 +0200 soxmax <soxma...@yahoo.com>
napsal/-a:

I recall seeing somewhere in MSDN that byte-count of single row in
a bitmap must be padded to DWORD boundary. DWORD is 4 bytes and since
your bit-count is 8 (1 byte), to have the bitmap correct, real width
must contain two padding bytes (to 932 which can be divided by 4).

But I am not completely sure about this so google first to either confirm
or dismiss my thoughts.

--
Jan Ringoš, Tri...@MX-3.cz
http://Tringi.MX-3.cz
http://www.ringos.cz

0 new messages