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
next
tos.WriteLine pixelRow
next
tos.Close
[/code]