I've never used imagemagick. Can that be compiled as a feature with PHP or are you calling the imagemagick commands to manipulate your images?
I did find something for GD: http://www.php.net/manual/en/function.imagettfbbox.php
If you find no other solution w/ imagemagick, try the GD one. You can either recode your program to use GD or you can use GD only to calculate the text boundaries and then use imagemagick to do the rest of the work
-sridhar