Skip to content

Instantly share code, notes, and snippets.

@taylorthurlow
Last active November 10, 2017 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taylorthurlow/3b544b2a10708124edff969bfbc6c913 to your computer and use it in GitHub Desktop.
Save taylorthurlow/3b544b2a10708124edff969bfbc6c913 to your computer and use it in GitHub Desktop.
A script which uses scrot and imagemagick to apply macOS-esque drop shadows to screenshots.
#!/bin/bash
# NAME: dropshadow.sh
# VERSION:
# AUTHOR: (c) 2017 Taylor Thurlow
# DESCRIPTION: - adds transparent dropshadow to images (e.g. screenshots)
# - moves them to predefined screenshot folder
# - notifies the user
# FEATURES:
# DEPENDENCIES: imagemagick suite
#
# LICENSE: MIT license (http://opensource.org/licenses/MIT)
#
# NOTICE: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
# OR OTHER DEALINGS IN THE SOFTWARE.
#
#
# USAGE: dropshadow.sh <image>
SCREENSHOTFOLDER="$HOME/screenshots"
FILE="${1}"
FILENAME="${FILE##*/}"
FILEBASE="${FILENAME%.*}"
# drop shadow: 60% opacity, 10 sigma, +0x +10y
convert "${FILE}" \( +clone -background black -shadow 60x10+0+10 \) +swap -background transparent -layers merge +repage "$SCREENSHOTFOLDER/${FILEBASE}.png"
notify-send -u low -t 2 "${FILEBASE}.png saved."
rm "$FILE" #remove this line to preserve original image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment