繁体   English   中英

具有wideImage lib的透明文本?

[英]Transparent text with wideImage lib?

我正在将http://wideimage.sourceforge.net/与PHP结合使用,我想在图像上写文本,该图像将以大约50%的比例透明。 可能吗?

是的,可以,但是需要您检索图像的TrueColor版本:

$image = $image->asTrueColor();

完成后,您只需执行以下操作即可以50%的alpha透明度编写文本:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM