Guest User

Untitled

a guest
Jan 18th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. <?php
  2. /* Read the image into the object */
  3. $im = new Imagick( 'a.png' );
  4. $im->setImageFormat("png");
  5.  
  6. /* Make the image a little smaller, maintain aspect ratio */
  7. $im->thumbnailImage( 200, null );
  8.  
  9. /* Clone the current object */
  10. $shadow = $im->clone();
  11.  
  12. /* Set image background color to black
  13. (this is the color of the shadow) */
  14. $shadow->setImageBackgroundColor( new ImagickPixel( 'black' ) );
  15.  
  16. /* Create the shadow */
  17. $shadow->shadowImage( 80, 3, 5, 5 );
  18.  
  19. /* Imagick::shadowImage only creates the shadow.
  20. That is why the original image is composited over it */
  21. $shadow->compositeImage( $im, Imagick::COMPOSITE_OVER, 0, 0 );
  22.  
  23. /* Display the image */
  24. header( "Content-Type: image/png" );
  25. echo $shadow;
Add Comment
Please, Sign In to add comment