Getting all pixels from image

I have a process in which needs to load in an image file and review each row to determine if the row contains all white pixels or not. To get started, I have created the code below that would output to a log file the results of the pixel values.

After testing the code, it appears to work; however, when I compare some of the coordinates of the image in GIMP to the log file it looks like I did not record properly. I am not sure if there is something I have not considered in the code below or something is wrong in my code.

Any advice will be appreciated.

[code] imageObject = picture.Open(imageFile)

imageWidth = imageObject.Width
imageHeight = imageObject.Height

dim c as color, rowLoop, colLoop, rowStart, pixelColor as integer, pixelRow as string

dim logFile as FolderItem = GetFolderItem(“c:\tmp\export\log.txt”)
dim tos as TextOutputStream,logLine as String

tos = TextOutputStream.Create(logFile)

redim imageSection(-1)
rowStart = 0

for rowLoop = 0 to imageHeight
pixelRow = “r” + right(“00000000” + rowLoop.ToText, 8)

for colLoop = 0 to imageWidth
  c = imageObject.Graphics.Pixel(rowLoop, colLoop)
  pixelColor = if((c.Red +  c.Green + c.Blue) = 765, 0, 1)
  pixelRow = pixelRow + ", " + pixelColor.ToText

tos.WriteLine pixelRow



Values may simply not be 765 in sum.

Christian, I think you are on to something in which I started to rethink the task the code is to perform.

the focus of the scan is to look for white spaces in which R 255, G 255, B 255 would add up to 765. If a non 765 number found, I would mark the row as having color values other than white.

looking back at my code, I think I see what happened in which I reversed my x, y in which I changed:

 c = imageObject.Graphics.Pixel(rowLoop, colLoop)


 c = imageObject.Graphics.Pixel(colLoop, rowLoop)

Graphics.pixel is slow.
Better RGBSurface.Pixel.
and put RGBSurface and width/height variables in local variables.

wow RGBSurface is faster!

thank you again Christian