Here is a simple example of creating a reflection of an image. The reflection is created by flipping the image and overlaying a gradient on it. Then both, the original image and the reflection is overlayed on a canvas.

This example is created for Imagick 2.1.x but with a little tuning it should work with earlier versions.

  1. <?php
  2.  
  3. /* Read the image */
  4. $im = new Imagick( "strawberry.png" );
  5.  
  6. /* Thumbnail the image */
  7. $im->thumbnailImage( 200, null );
  8.  
  9. /* Create a border for the image */
  10. $im->borderImage( "white", 5, 5 );
  11.  
  12. /* Clone the image and flip it */
  13. $reflection = $im->clone();
  14. $reflection->flipImage();
  15.  
  16. /* Create gradient. It will be overlayd on the reflection */
  17. $gradient = new Imagick();
  18.  
  19. /* Gradient needs to be large enough for the image
  20. and the borders */
  21. $gradient->newPseudoImage( $reflection->getImageWidth() + 10,
  22.                            $reflection->getImageHeight() + 10,
  23.                            "gradient:transparent-black"
  24.                         );
  25.  
  26. /* Composite the gradient on the reflection */
  27. $reflection->compositeImage( $gradient, imagick::COMPOSITE_OVER, 0, 0 );
  28.  
  29. /* Add some opacity */
  30. $reflection->setImageOpacity( 0.3 );
  31.  
  32. /* Create empty canvas */
  33. $canvas = new Imagick();
  34.  
  35. /* Canvas needs to be large enough to hold the both images */
  36. $width = $im->getImageWidth() + 40;
  37. $height = ( $im->getImageHeight() * 2 ) + 30;
  38. $canvas->newImage( $width, $height, "black", "png" );
  39.  
  40. /* Composite the original image and the reflection on the canvas */
  41. $canvas->compositeImage( $im, imagick::COMPOSITE_OVER, 20, 10 );
  42. $canvas->compositeImage( $reflection, imagick::COMPOSITE_OVER,
  43.                         20, $im->getImageHeight() + 10 );
  44.  
  45. /* Output the image*/
  46. header( "Content-Type: image/png" );
  47. echo $canvas;
  48.  
  49. ?>

The source image:

source

And the result:

result

P.S. Please send me some new images which I can use in these examples ;)