Steve Holden wrote:

Larry Bates wrote:

[...]

>I think I've come up with something that will work. I use PIL

Image.getcolors() to get colors and take the top 10 colors of my

background page. I then calculate the average of the R, G, B

components. That becomes my reference. Then I read a page and

make the same calculation. I then calculate the absolute value

of the difference of R, G, B of the two values. Sum those

together gives something like the average difference between

the two average colors (at least that is what I think it does).

This seems to give me small numbers when the pages are the same

and large numbers when they are different. It isn't super fast

but it is working.

Thanks for pushing me in the right direction.

-Larry

Well done! Thanks for letting me know that the basic approach was correct.

regards

Steve

Oh, by the way: instead of averaging over the *whole page*, now average

over (say) eight samples each of 10 x 10 pixels or thereabouts. They

should all be roughly the same, and they should all be close to the

color of the separator color.

Seems to me (again, without bothering to actually write the code, which

you are far more motivated to do than I anyway) that the much smaller

amount of arithmetic will compensate for any loss in accuracy (which I

surmise will anyway be trivial if the separator is something like DayGlo

green or yellow).

Or maybe it's already running "fast enough", and you are already on to

the next job?

regards

Steve

--

Steve Holden +1 571 484 6266 +1 800 494 3119

Holden Web LLC/Ltd

http://www.holdenweb.com
Skype: holdenweb

http://del.icio.us/steve.holden
------------------ Asciimercial ---------------------

Get on the web: Blog, lens and tag your way to fame!!

holdenweb.blogspot.com squidoo.com/pythonology

tagged items: del.icio.us/steve.holden/python

All these services currently offer free registration!

-------------- Thank You for Reading ----------------