'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.



Solution 1:[1]

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/

Solution 2:[2]

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

Solution 3:[3]

Shutter uses the following command https://github.com/shutter-project/shutter/blob/master/share/shutter/resources/system/plugins/perl/spshadow/spshadow#L375

convert in.png -gravity 'northwest' -background 'rgba(255,255,255,0)' -splice '10x10' \( +clone -background '#005f005f005f0000' -shadow "80x3-1-1" \) +swap -background none -mosaic +repage \( +clone -background '#005f005f005f0000' -shadow "80x3+5+5" \) +swap -background none -mosaic +repage out.png

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Konrad Reiche
Solution 2 nixnotwin
Solution 3 Adobe