BMP pixel array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.

james
 
Assuming you access the raw data using Image.LockBits the image data is aligned to the nearest 4 bytes, probably because the 32-bit registers would be able to read it faster.

The difference between a pixel line and a data line is

BitmapData.Stride - BitmapData.Width * resolution in bytes


Then again, I might have misunderstood you and you are talking about BMP image format and how to create a BMP image from scratch. In that case I can't help you.



As for how to code it better ... that depends on what you mean, what you do, and what you want to do.
 
Back
Top