Skip to content

Instantly share code, notes, and snippets.

@vadviktor
Created September 24, 2020 10:20
Show Gist options
  • Select an option

  • Save vadviktor/c447733d6e885c4e0f6c5c9669be18b3 to your computer and use it in GitHub Desktop.

Select an option

Save vadviktor/c447733d6e885c4e0f6c5c9669be18b3 to your computer and use it in GitHub Desktop.
Create a decent but narrow shadow with Imagemagick
#!/bin/bash
if [[ -f "${1}" ]]; then
tmp="${1%.*}"
convert "${1}" \( +clone -background gray -shadow 80x8+8+8 \) +swap -background white -layers merge +repage "${tmp}_drop-shadow.png"
fi
@sergey-alekseev
Copy link

Can you post some image examples? @vadviktor

@vadviktor
Copy link
Author

Original

screenshot-2020-10-02_08-46-30

Applied shadow

screenshot-2020-10-02_08-46-30_drop-shadow

@sergey-alekseev
Copy link

Nice. Reminds me a shadow added on Mac when you make a screenshot of a selected window, example:
Screen Shot 2020-10-02 at 16 56 51

@vadviktor
Copy link
Author

Exactly, that was the base of my initial search which led me to https://apple.stackexchange.com/questions/384323/create-macos-style-screenshots-with-drop-shadow-using-imagemagick from where I adapted most of the code, but tweaked it to my taste 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment