I do not know how pixels are represented? suppose I want to read an image pixel by pixel what type of object I can use to read the pixel's data within it and how to read the image pixel by pixel?

Recommended Answers

All 4 Replies

Have a look a LockBits

A pixel is the smallest thing that a image contains it can be a dot, square, line ect... If you want to read pixels from a image you ve got several methods in the bitmap class. I suggest you to use 2 for loops and go through each pixel (image cell) and do whatever you want to do. A image is actually a matrix with columns and rows (height,width) for example if you ve got 64 "rows" and 64 "columns" you would have 64^2 pixels in your image. Just don t think about the pixels as something physical, it doesn t have a native size. You can use the Color struct as an object to put data inside of it. The data would be then Argb data. The Argb value will depend upon the image pixels colors.

Is the pixel represented as a 3 bytes in memory one byte for each color of red, black and green?

Yes, and one more byte to reprsent transparancy. Making it a total of 32 bits.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.