GD library black/white

Hi, I’m looking for a function/class to make a picture grayscale instead of full color. I’ ve already seen some duotone classes but that’s not what I’m looking for. I want to make desaturated pictures of full color pics.

regards, bros