Re: BMP pixel array

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance





"Mike D Sutton" 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. 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.
>
> This is normal, each scan-line of Bitmap data is padded to align the next scan on a DWord (4-byte) boundary.
> Hope this helps,
>
> Mike
>
>
> - Microsoft Visual Basic MVP -
> E-Mail: EDais@xxxxxxxx
> WWW: Http://EDais.mvps.org/
>
>
>


Ok but I have a question with a real file: I have a BMP file with 399 bytes
in width and I find three zeros at the end of a sigle line. 399 + 3 = 402;
402 / 4 = 100.5; Following you suggestion I have to find only one zero.
Infact: 399 + 1 = 400; 400 / 4 = 100; perfect division by 4. This is what I
can't understand.

Another curious question about BMP file is that I have seen a BMP Info
Header with dimension less than 40; in this case 12; I've seen that the file
width and height are in two byte everyone and not in four byte like the BMP
files with an Info Header of 40 byte. Is it right? Why it happen.

Thank you
.



Relevant Pages

  • Re: Storing/Saving a BMP in ASM
    ... To save a BMP in any language, assuming you have access to the pixel's ... values on screen (you can read the bitmap from screen), ... Info on how to store the lines and what the header should ...
    (comp.lang.asm.x86)
  • Re: BMP
    ... That's definitely not a bmp header. ... about a bitmap after it's loaded. ...  4 | data offset ...
    (comp.graphics.algorithms)
  • Re: BMP pixel array
    ... Is this a .BMP file or a Bitmap data array? ... is it using some kind of compression such as RLE or Bit-fields or is the data uncompressed? ... > files with an Info Header of 40 byte. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: BMP Pixel array
    ... > I can't understand why, in the BMP array after the headers, i find ... > some zero that aren't in the real BMP image. ... Each scan line is padded with zeros so that the following scanline falls ...
    (microsoft.public.vc.language)
  • Re: BMP
    ... now my query is that if this is a complete header for bmp file then ... That's definitely not a bmp header. ... about a bitmap after it's loaded. ... | data offset ...
    (comp.graphics.algorithms)