473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 1830
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Leif Wessman | last post by:
Hi, What am I doing wrong here? I want to display a transparent pixel... <? $transparent1x1 = array (71, 73, 70, 56, 57, 97, 1, 0, 1, 0, -128, 0, 0, 0, 0, 0, 0, 0, 0, 33, -7, 4, 1, 0, 0, 0,...
2
by: Aravind | last post by:
Hi guys, I want to read the pixel value from an image and to store them in an array.any help regarding this is appriciatable. Thanks in Advance, Aravind
2
by: victor | last post by:
hello, I have several arrays containing (image-) pixel data; I want to display it onto a PictureBox. What is the best Graphics method for it? (MSDN examples talks only about loading it from...
1
by: james | last post by:
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...
4
by: Brian L. Troutwine | last post by:
I've recently begun to teach myself pygame by making a bunch of small toys. My current toy is cellular automata displayer and I've gotten a bit stuck on the displaying bit. (If automata isn't the...
30
by: Chaos | last post by:
As my first attempt to loop through every pixel of an image, I used for thisY in range(0, thisHeight): for thisX in range(0, thisWidth): #Actions here for Pixel thisX, thisY But it takes...
1
by: janaki112 | last post by:
my 1 dimensional pixel array is named => intensity (got by using pixel grabber) I have created an image using Code: Container n=new Container(); Image img=n.createImage(new...
1
by: ofiras | last post by:
In bitmap, how can I find the nearest pixel (pixel 1) to a specific pixel (pixel 2) that has different color from pixel 2? Or how can I find a pixel in a specific distance from pixel 2 (like a...
7
by: w1ck3d64 | last post by:
hi, i have an array of pixel information which i want to display with C/C++. I'm trying to use OpenCV at the moment but I don't have much experience writing pixel by pixel. Can someone show me a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.