Say there are 3 circles: red, blue, black.
I only want the black circle to remain. How can I remove the red and blue circles?
If you know what image format that is being used, you could likely use that information to avoid accessing through pixel values (possibly destroying image quality), otherwise do something similar to this:
This relies on that there is a given background color at any time that the pixels can be set to and that you can identify the colors to remove.