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?
Since you have asked for a PHP solution:
Now, what you can loop over all pixels via
for ($i = 0; $i < $imageWidth; $i++) {
for ($j = 0; $j < $imageHeight; $j++) {
// check color and replace
}
}
Finally, use imagecolorat to get the color (check if it is in a specific range, don't take only black as a good color, but also all colors that have >= 250 at each value of red, green and blue for example)