Monday, May 18, 2009

ImageMagickとPHPで回転させたグラデーションを描画する

Imagickで回転させたグラデーションを描画するには、以下のコードを実行します。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja" dir="ltr">
<head>
<title>sample1094(ImageMagick6.5.2)</title>
</head>
<body>
<?php
$im = new Imagick();
$im->newPseudoImage(200, 200, "gradient:#bbddffff-#ffffffff");
$im->setImageMatte(true);
$points = array(45);
//$im->distortImage(Imagick::DISTORTION_SCALEROTATETRANSLATE, $points, false);
// ScaleRotateTranslateDistortion in distort.h
$im->distortImage(3, $points, false);
$im->writeImage('sample1094a.png');
$im->destroy();
?>
<img src="sample1094a.png" />
</body>
</html>

出力画像(sample1094a.png)
Imagickで描画した回転させたグラデーション

No comments: