Imagick::annotateImage


wizard apg

ANNOTATES an image with text.



<?php

bool 
public Imagick::annotateImage(
                              
ImagickDraw $draw_settings,
                                           
float $x,
                                           
float $y,
                                          
float $angle,
                                        
string $text
                                            
);
                                            
?>

$draw_settigs


The ImagickDraw object that contains settings for drawing the text.



$x


The horizontal offset in pixels to the left of text.



$y


The vertical offset in pixels to the left of text..



$angle


The angle at which to write the text.



$text


The text to be drawn.





This function returns a TRUE on success.



  1 EXERCISE   

<?php

$image 
= new Imagick();

$str1img = 'img/results/571.jpg';

$image = new Imagick();
$draw = new ImagickDraw();
$pixel = new ImagickPixel( 'yellow' );

$image->newImage(400, 75, $pixel);

$draw->setFillColor('blue');

$draw->setFont('DancingScript-Regular.ttf');
$draw->setFontSize( 30 );

$image->annotateImage($draw, 65, 45, 0, 'Zerof is my nickname');

$image->setImageFormat('jpg');

$Data = $image->getImageBlob();
  
$img = imagecreatefromstring($Data);

imagebmp($img, $str1img);

echo 
basename($str1img); ?>
<br><br>
<img src="<?php echo $str1img; ?>"
 alt="<?php echo $str1img; ?>" 
 title="<?php echo $str1img; ?>">

 RESULT   

571.jpg

img/results/571.jpg apr