The ImagickDraw::setFontSize() function is an inbuilt function in PHP which is used to set the font point size. It is used when annotating with text.
Syntax:
bool ImagickDraw::setFontSize( $pointsize )
Parameters: This function accepts a single parameter $pointsize which is used to hold the value of point size.
Return Value: This function does not return any value.
Below programs illustrate the ImagickDraw::setFontSize() function in PHP:
Program 1:
php
<?php
$draw = new ImagickDraw();
$draw->setFillColor('Green');
$draw->setFontSize(30);
$draw->setFontFamily('Ani');
$draw->annotation(30, 40, "GeeksForGeeks");
$imagick = new Imagick();
$imagick->newImage(250, 70, 'white');
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>
|
Output:

Program 2:
php
<?php
$draw = new ImagickDraw();
$draw->setFillColor('red');
$draw->setFontSize(40);
$draw->setFontFamily('Ubuntu-Mono');
$draw->annotation(30, 170, "GeeksForGeeks");
$draw->setFillColor('green');
$draw->setFontSize(30);
$draw->setFontFamily('Open-Sans-Light-Italic');
$draw->annotation(30, 250, "Ubuntu-Mono");
$imagick = new Imagick();
$imagick->newImage(350, 300, 'white');
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>
|
Output:

Reference: http://php.net/manual/en/imagickdraw.setfontsize.php
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
04 Oct, 2021
Like Article
Save Article