無料で配布されている「怨霊
」というフォントがありましたので使ってみます。
ホラー風フォントということで、どれくらい恐ろしいか試してみます。
■ソースコード
use strict;
use Encode qw/from_to/;
use Image::Magick;
#黒背景のキャンバスを用意する
my $img= Image::Magick->new;
$img->Set(size=>'160x520');
$img->Read("xc:black");
#テキストはUTF-8変換
my $text= <<EOT;
そ
ん
な
し こ
ょ と
う 言
が っ
な た
い っ
じ て
ゃ
な
い
か
EOT
from_to($text, "shiftjis", "utf-8");
#文字入れ
$img->Annotate(text=>$text, fill=>'Red', font=>'C:\onryou.ttf', pointsize=>32, encoding=>'UTF-8', x=>40, y=>60);
#出力
$img->Write("onryou.png");
■出力画像
ううーむ。。。思ったほど怖くはない?
したらば効果を加えて頑張って怖くしてみます。
■ソースコード
use strict;
use Encode qw/from_to/;
use Image::Magick;
my $img= Image::Magick->new;
$img->Set(size=>'160x520');
$img->Read("xc:black");
my $text= <<EOT;
そ
ん
な
し こ
ょ と
う 言
が っ
な た
い っ
じ て
ゃ
な
い
か
EOT
from_to($text, "shiftjis", "utf-8");
#文字入れ
$img->Annotate(text=>$text, stroke=>'Red', fill=>'Red', font=>'C:\onryou.ttf', pointsize=>32, encoding=>'UTF-8', x=>40, y=>60);
#コピー
my $img2= $img->Clone();
#ぼかす
$img->MotionBlur(radius=>40, sigma=>14.0, angle=>270);
#重ね合わせ
$img->Composite(image=>$img2, compose=>'Difference');
#出力
$img->Write("onryou2.png");
■出力画像
ん~。。どーでしょー。。。