PHP Imagick how to best fit text annotation
I'm adding annotation text to a newPseudoImage which works fine but I'd like to make the text scale to fit the image size. Any ideas how I might do this? $im = new Imagick(); $draw = new ImagickDraw(); $draw->setFillColor($color); $draw->setFont($font); $draw->setFontSize(($width, $height) / 100) * 15); $draw->setGravity(Imagick::GRAVITY_CENTER); $im->newPseudoImage($width, $height, "canvas:{$bg}"); $im->annotateImage($draw, 0, 0, 0, $text); $draw->clear(); $draw->destroy(); $im->setImageFormat('gif'); header("Content-Type: image/gif"); echo $im; I think you could use the imageftbbox function