Feb-14-2017, 08:22 PM
Once you've loaded the image as a surface, then you can access that surface's pixels with a PixelArray. The PixelArray class has a replace method, which replaces all instances of one color with another (so you don't need to check individual pixels yourself). When you create a PixelArray, it locks the underlying surface until it's garbage collected, so you should delete it when you're done (or use a function and return from it).
http://www.pygame.org/docs/ref/pixelarra...ay.replace
So...
http://www.pygame.org/docs/ref/pixelarra...ay.replace
So...
surface = load_image() # ...whatever you're already doing pixels = PixelArray(surface) pixels.replace(Color(255, 255, 255, 255), Color(0, 0, 255, 255)) del pixels