Re: BMP Pixel array



"james" <james@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>I don't know if this is the right place to show my question.
>I can't understand why, in the BMP array after the headers, i find some zero
>that aren't in the real BMP image. This zero are at the end of a single pixel
>row. Sometime i find three zeros. I've seen, in a web page, that if a row
>ins't a multiple of 4 it need to add one, two or three zeros to reach this
>multiple of 4.

That's a multiple of 4 bytes. The units are important.

>I've tried to understand it but with no positive result.
>Somebody can explain me how this work? If you know a code about it better.

Here's an example. Say you have a 4-bit DIB in a bitmap, 6 pixels wide by
6 pixels high, filled with solid bright red. Bright red in a 4-bit DIB is
color index C. 6 pixels in a 4-bit DIB takes 3 bytes: CC CC CC. However,
as you have read, lines in a DIB have to be a multiple of four bytes. So,
the bytes in the DIB will look like:

CC CC CC 00
CC CC CC 00
CC CC CC 00
CC CC CC 00
CC CC CC 00
CC CC CC 00

Everyone that uses the DIB will know that they are supposed to ignore that
extra byte, because the rules say so.
--
- Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc
.



Relevant Pages

  • Re: BMP pixel array
    ... > I can't understand why, in the BMP array after the headers, i find some zero ... This zero are at the end of a single pixel ... > ins't a multiple of 4 it need to add one, two or three zeros to reach this ...
    (microsoft.public.win32.programmer.gdi)
  • BMP Pixel array
    ... I can't understand why, in the BMP array after the headers, i find some zero ... ins't a multiple of 4 it need to add one, two or three zeros to reach this ...
    (microsoft.public.vc.language)
  • BMP pixel array
    ... I can't understand why, in the BMP array after the headers, i find some zero ... ins't a multiple of 4 it need to add one, two or three zeros to reach this ...
    (microsoft.public.dotnet.general)
  • BMP pixel array
    ... I can't understand why, in the BMP array after the headers, i find some zero ... ins't a multiple of 4 it need to add one, two or three zeros to reach this ...
    (microsoft.public.win32.programmer.gdi)
  • BMP pixel array
    ... I can't understand why, in the BMP array after the headers, i find some zero ... ins't a multiple of 4 it need to add one, two or three zeros to reach this ...
    (microsoft.public.dotnet.languages.vc)

Loading