i think these will do the trick.
pear:
http://graphpite.sourceforge.net…
http://pear.php.net/package/Imag…