How to Add a Drop Shadow in ImageMagick?

Adding a professional drop shadow to an image using ImageMagick’s convert command involves a specific sequence of duplicating the image, creating a blurred shadow mask, and compositing the original image on top. This guide breaks down the exact command-line syntax, explains what each parameter does, and provides a practical example so you can add depth to your digital images instantly.

The Standard Drop Shadow Command

To create a clean, modern drop shadow, you need to use a single, chained ImageMagick command. Here is the standard syntax used to achieve this effect:

magick convert input.png \( +clone -background black -shadow 80x5+10+10 \) +swap -background none -layers merge +repage output.png

Note: If you are using ImageMagick v7 or newer, you can simply use magick instead of magick convert. If you are on Windows PowerShell, you do not need to escape the parentheses with backslashes, so use ( and ) instead of \( and \).

Breaking Down the Parameters

Understanding how each flag works allows you to customize the intensity, blur, and position of your shadow:

Customizing Your Shadow

You can adjust the parameters to match different design aesthetics.

For a subtle, modern “soft glow” look that lifts the image straight off the page rather than casting a directional light, you can set the offsets to zero and increase the blur:

magick convert input.png \( +clone -background black -shadow 60x10+0+0 \) +swap -background none -layers merge +repage output.png

For a hard, retro pop-art shadow, reduce the blur to zero and increase the opacity:

magick convert input.png \( +clone -background `#555555` -shadow 100x0+15+15 \) +swap -background none -layers merge +repage output.png