pngtocss takes in a png file with a gradient in it and spits out the necessary CSS to draw that gradient.
See the project page for full details.
You can also download a binary for MacOSX.
There are a bunch of examples on the examples page.
The code is BSD Licensed and Copyright Philip Tellis -- philip@bluesmoon.info -- http://bluesmoon.info/