I want to be able to have a sort of function, where I can type for example.

changeme(picture1, RGB1, RGB2)

and it would change all pixels matching RGB1 into RGB2, and it must be fast, looping thru each pixel is painstakinly slow.