CODE
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace ProgrammingExercice
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Bitmap image = new Bitmap("PNG.png");
Color col = new Color();
ArrayList wit = new ArrayList();
pb_image.Image = image;
int breedte = image.Size.Width;
int hoogte = image.Size.Height;
for (int i = 0; i < hoogte; i++)
{
for (int j = 0; j < breedte; j++)
{
col = image.GetPixel(j, i);
if (col.Equals(Color.White))
{
wit.Add(i * 100 + breedte);
}
}
}
MessageBox.Show(wit[0].ToString()); //this gives me the error
}
}
}
This is the image I use:

When I debug my program it gives me an error when I try to print the first element of arraylist wit. There are nog elements in it

that's weird because there are alot of white pixels.. Is there something wrong with my if statement?
CODE
wit.Add(i * 100 + breedte);
Oh and this is because all my pixels are numbered from 0 to 99 the first row, 100 to 199 second, ...
I would really appreciate some help.
thx, Jasper
edit: should I compare the pixel to the R, G, B values separatly? I'll give it a try, reply for tips plz
This post has been edited by thejasper: 5 Jan, 2008 - 04:57 AM