开发者

Transparent text with wideImage lib?

I am using http://wideimage.sourceforge.net/ w开发者_如何转开发ith PHP and I would like to write text on image which will be transparent in about 50%. Is it possible?


Yes, it is possible, but requires you to retrieve the TrueColor version of the image:

$image = $image->asTrueColor();

Once that is done, you can simply do the following to write text with 50% alpha transparency:

$color = $image->allocateColorAlpha(255, 255, 255, 63);
$canvas = $image->getCanvas();
$canvas->useFont('path/to/font.ttf', 16, $color);
$canvas->writeText('right', 'bottom', 'Hello, world!');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜