我正处于 ImageMagick 学习曲线的开始阶段。我已经成功地在带有外部光阴影的图案背景上创建了一些文本,以提供剪切文本的漂亮外观。为了完成效果,我需要给文本和内部暗阴影。有没有 ImageMagick 专家可以帮助解决 php 问题?到目前为止,这是我很满意的代码。
<?php
header('Content-type: image/jpeg');
$background_layer = new Imagick('test_background.jpg'); # background image
$d = $background_layer->getImageGeometry();
$w = $d['width'];
$h = $d['height'];
$text_layer = new Imagick();
$text_layer->newImage($w, $h, new ImagickPixel('none'));
$text_layer->setImageFormat('png');
$ImagickDraw = new ImagickDraw();
$ImagickDraw->setFillColor('#484848');
$ImagickDraw->setFont('Helvetica-Bold');
$ImagickDraw->setFontSize( 40 );
$ImagickDraw->setTextAlignment(2); // centre
$text_layer->annotateImage( $ImagickDraw, $w / 2, 50, 0, "Stuart's\niPhone" );
// create white drop shadow on it's own layer
$shadow_layer_white = $text_layer->clone();
$shadow_layer_white->setImageBackgroundColor( new ImagickPixel( 'white' ) );
$shadow_layer_white->shadowImage( 70, .3, 1, 1 );
// composite original text_layer onto shadow_layer
$shadow_layer_white->compositeImage( $text_layer, Imagick::COMPOSITE_OVER, 0, 0 );
// composite shadow_layer (which now has text AND the shadow) onto image_layer
$background_layer->compositeImage( $shadow_layer_white, Imagick::COMPOSITE_OVER, 0, 0 );
echo($background_layer);
?>
我太新了,无法发布图片,所以你可以看到我到目前为止的内容
http://www.avforums.com/images/temptest.php
您可以提供任何帮助以在文本中添加内部深色阴影,我们将不胜感激。谢谢