473,396 Members | 1,772 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,396 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 1832
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.