PHP | ImagickDraw setFontSize() Function
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
Last Updated :
04 Oct, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...