array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'imagick.annotateimage.php', 1 => 'Imagick::annotateImage', ), 'up' => array ( 0 => 'class.imagick.php', 1 => 'Imagick', ), 'prev' => array ( 0 => 'imagick.animateimages.php', 1 => 'Imagick::animateImages', ), 'next' => array ( 0 => 'imagick.appendimages.php', 1 => 'Imagick::appendImages', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/imagick/imagick/annotateimage.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL imagick 2, PECL imagick 3)
Imagick::annotateImage — 画像にテキストによる注記を加える
$draw_settings
,$x
,$y
,$angle
,$text
テキストによる注記を画像に加えます。
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;
?>