Well, you could do it in GD
by taking the color of each pixel, removing the saturation (i.e. setting it to 0), and replacing the pixel with the new color. But this, as you might imagine, would be horribly slow.
You're much better off using the Imagick
extension, which I believe has a built-in function for this.