I have a bunch of pictures (mostly screenshots, but it doesn't matter) to which I'd like to add a drop shadow. (Reason for it is to add a nice border, as they have white background and I use them on a white background.)

My current workflow is:

  • open the .png file in Inkscape,
  • Filters/Shadow and glow/Drop shadow,
  • select a 3px blur radius, with a 2px 2px offset,
  • export the modified .png.

However, this is done all manually… and it is quite annoying when I have more than… 2 pictures.

I know Inkscape can be used with Command Line Interface (CLI) (I'm on Ubuntu 18.04). I know how to import and export files. However, I don't know how to apply a given filter.

Here's what I've tried, it didn't work:

$ inkscape --verb org.inkscape.effect.filter.ColorDropShadow --verb FileSave --verb FileClose image.png

Hence, could you tell me how to add drop shadow to a picture using CLI?
(This could be done using either Inkscape, or any other open-source software running on Linux)

  • My current progress so far: $ inkscape --verb org.inkscape.effect.filter.ColorDropShadow --verb FileSave --verb FileClose image.png but it is not working.
    – ebosi
    Commented Nov 19, 2018 at 13:15
  • You might get more out of your your cmd if you used imagamagick instead
    – joojaa
    Commented Nov 19, 2018 at 17:17
  • You need to export to png, not save.
    – Moini
    Commented Nov 19, 2018 at 17:27
  • 1
    For this verb a GUI is required as the text output says: WARNING: ignoring verb org.inkscape.effect.filter.ColorDropShadow - GUI required for this verb.
    – sebix
    Commented Nov 20, 2018 at 20:30
  • 1
    So, to do this properly your script needs to: open the file, select everything in it, apply the noprefs dropshadow filter, then export the selected object to png as a whole (the filter will make it larger, so exporting the page area will not work).
    – Moini
    Commented Nov 21, 2018 at 1:11

2 Answers 2


Rather than using the vector graphic tool Inkscape I would recommend the ultimate command line tool for bitmap manipulations: ImageMagick.

It should be available through your distribution repositories. This tool comes with many effects, including generating a drop shadow.

This is basically done with the convert -shadow option but you then need to combine the generated background image again with the original. This can all be done in a one-line command using -layers merge option:

convert input.jpg \( +clone -background black -shadow 50x10+15+15 \) +swap -background none -layers merge +repage shadow.png

Useful options for the drop shadow are determined with -background <color> and -shadow percent-opacity{xsigma}{+-}x{+-}y{%}. The example above generates a grey drop shadow with 50% opacity, 10% size and x=+15% y=+15% offset:

enter image description here

Source of above information and more options, and different shadow types see:

  • this is exactly what I'm needing – enabling drop-shadow settings as CLI argument is a real plus. thank you!
    – ebosi
    Commented Nov 23, 2018 at 10:11
  • Unfortunately this Q&A appears as the most trusted or relevant source when you search for how to add a drop shadow in Inkscape with the CLI. I agree that the question was about bitmap graphics, but I'm now a bit disappointed and confused. It's not getting better when asking "GPT", just more fluff with the same reference and remarks that it can be done, apparently.
    – LiveWireBT
    Commented Apr 26, 2023 at 10:32

Based on Takkat's answer, here is the bash function I have added to my .bashrc:

function dropshadow () {
    filename=$(basename -- "$1")
    # extension="${filename##*.}"
    # we want to enforce png (even if .jpg as input)
    convert "$1" \( +clone -background black -shadow 50x10+5+5 \) +swap -background none -layers merge +repage "$basename$suffix"
  • Usage: dropshadow <yourfile.ext>,
  • Output: creates <yourfile>_shadow.png in your current working directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.