Hi,
I wrote software to do something like this a long time ago, when I worked at a usenet provider an we needed to track spam images. I broke each image down into smaller square images, and downsampled each to 8 bit, then calculated a "color average" of all the pixels in each sample. If one image matched enough samples to another image they were considered the same.
It didn't work for what i needed though, because it would find similar images (a person moved an arm, but everything else was the same for example). Unfortunately, I don't have the source available.