Colorkeying!

Is there a way to use colorkeying in opengl? For example, I have an image that is loaded with DevIL (i know its data), and I want the black color to be transparent. How do i do that??

First allocate a new image with room for all color components in the original image plus an alpha channel. Copy each pixel from the old image to the new, and set the alpha channel to either one or zero, depending on the color. If black, set it to zero. Then use alpha test to reject pxiels with alpha other than one, that is, black pixels.

Thanks a lot!