Actually, PHP doesn't come with native support for it (though I don't if GD provides any such features). You might be interested in the ImageMagick suite provided by the PEAR group in a PECL library called 'imagick.so'. See,
http://pear.php.net/manual/en/pecl.imagick.php
This library is a direct API interface to ImageMagick. Note though, it is still being developed and unless you call functions correctly, it has a tendency to segfault the process.