471,348 Members | 1,543 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

BMP pixel array

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
Jul 21 '05 #1
1 1728
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.
On Sun, 22 May 2005 19:42:02 +0200, james <ja***@discussions.microsoft.com> 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.

james


--
Happy coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Leif Wessman | last post: by
2 posts views Thread by victor | last post: by
1 post views Thread by james | last post: by
4 posts views Thread by Brian L. Troutwine | last post: by
30 posts views Thread by Chaos | last post: by
1 post views Thread by ofiras | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.