Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create drop shadow effects in Imagemagick

The border shadow effects used in the images of this blog post seem to be embeded in the images themselves (not css3). How can it be created in imagemagick?

Edit 1: The solution which I found quite accidentlly is posted below as an answer.

like image 991
nixnotwin Avatar asked Jun 15 '11 00:06

nixnotwin


2 Answers

Somehow I found the command which does what I wanted exactly:

Image with white border and dropshadow

For images which are already scaled and compressed:

 convert input.jpeg -bordercolor white -border 13 \( +clone -background black -shadow 80x3+2+2 \) +swap -background white -layers merge +repage output.jpg

For creating thumbnails:

 convert input.jpeg -thumbnail 200x200 -bordercolor white -border 6 \( +clone -background black -shadow 80x3+2+2 \) +swap -background white -layers merge +repage  output.jpg

For raw images:

convert input.jpeg -scale 600x400 -quality 86 -strip -bordercolor white -border 13 \( +clone -background black -shadow 80x3+2+2 \) +swap -background white -layers merge +repage output.jpg
like image 87
nixnotwin Avatar answered Oct 21 '22 18:10

nixnotwin


There is a -shadow argument on convert that has options to do this.

http://web.archive.org/web/20120607055659/http://blog.bemoko.com/2009/07/01/add-shadow-and-border-to-images-with-imagemagick/

like image 42
Lou Franco Avatar answered Oct 21 '22 16:10

Lou Franco