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!');
精彩评论