Imagick::annotateImage

(PECL imagick 2, PECL imagick 3)

Imagick::annotateImage画像にテキストによる注記を加える

説明

publicImagick::annotateImage(
    ImagickDraw$draw_settings,
    float$x,
    float$y,
    float$angle,
    string$text
): bool

テキストによる注記を画像に加えます。

パラメータ

draw_settings

テキスト描画設定を含む ImagickDraw オブジェクト。

x

テキストの左端の水平オフセットをあらわすピクセル数。

y

テキストのベースラインの垂直オフセットをあらわすピクセル数。

angle

テキストを書き出す角度。

text

描画するテキスト。

戻り値

成功した場合に true を返します。

例1 Imagick::annotateImage() の使用法

空の画像にテキスト注記を加えます。

<?php

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


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


$draw->setFillColor('black');


$draw->setFont('Bookman-DemiItalic');
$draw->setFontSize( 30 );


$image->annotateImage($draw, 10, 45, 0, 'The quick brown fox jumps over the lazy dog');


$image->setImageFormat('png');


header('Content-type: image/png');
echo
$image;

?>

参考

To Top