ImageMagick equivalent to Box-shadow CSS property

I want to imitate the box-shadow CSS property in ImageMagick for an image. I want it to behave exactly the same. Is there any function or equivalent mapping?

Problem courtesy of: Sanket Sahu



  /* Make the image a little smaller, maintain aspect ratio */
  $im->thumbnailImage( 200, null );

  /* Clone the current object */
  $shadow = $im->clone();

  /* Set image background color to black (this is the color of the shadow) */
  $shadow->setImageBackgroundColor( new ImagickPixel( 'black' ) );

  /* Create the shadow */
  $shadow->shadowImage( 80, 3, 5, 5 );

  /* Imagick::shadowImage only creates the shadow. That is why the original image is composited over it */
  $shadow->compositeImage( $im, Imagick::COMPOSITE_OVER, 0, 0 );

 /* Display the image */
 header( "Content-Type: image/jpeg" );
 echo $shadow;

also you can see imagemagick for bash script

Solution courtesy of: donald123

CSS3 Recipes责编内容来自:CSS3 Recipes (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 前端开发 » ImageMagick equivalent to Box-shadow CSS property

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录