shotshadows – Quick Script to Enable or Disable Screenshot Shadows

If you’ve taken screenshots of windows in Tiger and Leopard using the command-shift-4+space trick, you’ll have noticed that Leopard will include the window’s (rather large) drop shadows in the resulting image. Depending on your point of view this can be good, bad, or a mixed blessing. I’m in the latter camp. They can be nice for blog posts, but if you’re creating documentation, for example, they can take up precious space on the page.

Using this hint as a starting point, I wrote the following bash script to make the process of disabling and enabling those shadows quick and painless:

#!/bin/bash

usage ()
{
    /bin/echo "Usage: shotshadows [off|on]"
    exit 1
}

if [ $# == 1 ]; then
    if [ $1 == "off" ]; then
	    /bin/echo "Disabling drop shadows in screenshots and restarting SystemUIServer"
	    /usr/bin/defaults write com.apple.screencapture disable-shadow -bool true
	    /usr/bin/killall SystemUIServer
    elif [ $1 == "on" ]; then
        /bin/echo "Enabling drop shadows in screenshots and restarting SystemUIServer"
        /usr/bin/defaults delete com.apple.screencapture disable-shadow
        /usr/bin/killall SystemUIServer
    else
        usage
    fi
else
	usage
fi

Save this script as shotshadows — or download it here — make it executable, and drop it somewhere in your path. (I use /usr/local/bin.) Now you can turn screenshot shadows on and off with the simple terminal commands shotshadows on and shotshadows off. The change takes effect instantly.

About these ads

About pmbuko
mac/linux geek

3 Responses to shotshadows – Quick Script to Enable or Disable Screenshot Shadows

  1. victor says:

    …make it executable… How?

  2. Tudor says:

    Thanks a lot for this! Really great stuff, you’ve just saved me quite a bit of work in removing unwanted shadows :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 390 other followers

%d bloggers like this: