Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I create an inner drop shadow in text with php Imagick please?
    primarykey
    data
    text
    <p>I'm at the beginning of the learning curve with ImageMagick. I have successfully created some text on a patterned background with outer light drop shadow to give the nice appearance of cut-out text. To finish off the effect I need to give the text and inner dark drop shadow. Are there any ImageMagick experts out there who can help with the php please? This is my code so far which I'm happy with.</p> <pre><code>&lt;?php header('Content-type: image/jpeg'); $background_layer = new Imagick('test_background.jpg'); # background image $d = $background_layer-&gt;getImageGeometry(); $w = $d['width']; $h = $d['height']; $text_layer = new Imagick(); $text_layer-&gt;newImage($w, $h, new ImagickPixel('none')); $text_layer-&gt;setImageFormat('png'); $ImagickDraw = new ImagickDraw(); $ImagickDraw-&gt;setFillColor('#484848'); $ImagickDraw-&gt;setFont('Helvetica-Bold'); $ImagickDraw-&gt;setFontSize( 40 ); $ImagickDraw-&gt;setTextAlignment(2); // centre $text_layer-&gt;annotateImage( $ImagickDraw, $w / 2, 50, 0, "Stuart's\niPhone" ); // create white drop shadow on it's own layer $shadow_layer_white = $text_layer-&gt;clone(); $shadow_layer_white-&gt;setImageBackgroundColor( new ImagickPixel( 'white' ) ); $shadow_layer_white-&gt;shadowImage( 70, .3, 1, 1 ); // composite original text_layer onto shadow_layer $shadow_layer_white-&gt;compositeImage( $text_layer, Imagick::COMPOSITE_OVER, 0, 0 ); // composite shadow_layer (which now has text AND the shadow) onto image_layer $background_layer-&gt;compositeImage( $shadow_layer_white, Imagick::COMPOSITE_OVER, 0, 0 ); echo($background_layer); ?&gt; </code></pre> <p>I'm too new to post images so you can see what I have so far at</p> <p><a href="http://www.avforums.com/images/temptest.php" rel="nofollow">http://www.avforums.com/images/temptest.php</a></p> <p>Any help you can give to add an internal dark drop shadow in the text would be appreciated. Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload