This article originally appeared in TidBITS on 2015-04-25 at 10:52 a.m.
The permanent URL for this article is: http://tidbits.com/article/15616
Include images: Off

How to Eliminate Drop Shadows in OS X Screenshots

by Josh Centers

For anyone who documents tasks performed on the Mac, being able to take consistent, high-quality screenshots is paramount. We use some screenshots in TidBITS articles, but where we really rely on them are in Take Control books, which may include a hundred or more graphics.

There are dozens of screenshot utilities for the Mac, but Apple’s built-in screenshot functionality is pretty good, free, and doesn’t consume system resources. (And most of the utilities have gotten worse over the years, as Apple has removed the capabilities they relied on.) But there is a problem: OS X adds a drop shadow to each screenshot of an individual window.

Throwing Light on Shadows -- For everyday users, who rarely take screenshots anyway, this is a benefit, since the drop shadow adds a visually pleasing border. But for us publishing types, the drop shadow can cause all sorts of problems. Most important, it’s much larger than a plain border, which wastes a ton of space in a book or article page. It can be edited out, but that requires additional time and effort. We’ve also had issues with the alpha channel, in which the drop shadow ends up becoming a large black border around the entire screenshot.

[image link] [1]

Thankfully, Apple offers simple, but obscure, solutions. One uses a keyboard shortcut for a temporary fix, while the other is a Terminal command that solves the problem permanently.

You probably know about the keyboard shortcut to take a screenshot of a portion of the screen: Command-Shift-4. (There’s also Command-Shift-3, which takes a screenshot of your entire screen, a trick that’s seldom useful.) Pressing Command-Shift-4 turns your cursor into a crosshair, and dragging out a rectangle takes a screenshot of the selected area. Less well known is the fact that if, instead of dragging out a rectangle, you press the Space bar, your cursor becomes a camera, and placing it over a window, dialog, or dropped-down menu highlights that object. Click the highlighted object and you get a screenshot of just that object, complete with drop shadow, on your Desktop.

But what if you don’t want the drop shadow? Easy. Instead of clicking the highlighted object, Option-click. That produces the same screenshot with no drop shadow.

What if you never want a drop shadow on your screenshots (like us)? In that case, you need to fire up the Terminal app. Then enter this command, courtesy of the just-released second edition of Joe Kissell’s “Take Control of the Mac Command Line with Terminal [2].”

defaults write com.apple.screencapture disable-shadow -bool TRUE; killall SystemUIServer

Don’t be scared by the killall command. All it does is quit and relaunch the process that maintains the user interface to reflect the drop shadow setting in the first part of the command.

If you later want to re-enable drop shadows, open Terminal and enter this command:

defaults write com.apple.screencapture disable-shadow -bool FALSE; killall SystemUIServer

Adding Borders -- But what if you need a border around a screenshot so white edges don’t bleed into the white of the background? You could add one in Photoshop or Pixelmator, but that’s like driving nails with a sledgehammer: potentially fun, but more work than necessary. And as much as the image-annotation utility Napkin is great, it can’t yet add a simple line border (see “Napkin Offers a Fresh Take on Visual Communication [3],” 16 February 2013). Thankfully, Apple’s built-in Automator can do this for you, with a workflow also courtesy of Joe Kissell. We rely on this Automator workflow for Take Control all the time.

First, you need to download a free Quartz Composition filter called Borders [4], unzip it, and move the BC_Borders_1.5.qtz file to ~/Library/Compositions (remember that your Library folder may be hidden; hold down the Option key and choose Library from the Go menu in the Finder if so).

Next, open Automator and choose File > New. Select Application as your document type. Double-click the Get Selected Finder Items action to add it to the workflow as the first item. If you don’t want to modify the original screenshot, add the Copy Finder Items action to your workflow instead.

Now search on “quartz” to find and add the action “Apply Quartz Composition Filter to Image Files.” The default filter is Sepia. Instead, choose Borders from the drop-down menu. Feel free to experiment with the Border Size, Bottom Border Bias, and Border Color settings, but we use 1, 0, and dark gray, respectively. The workflow can take a few seconds to run, so if you want feedback that it has completed, add a Play System Sound or Speak Text action to the end.

[image link] [5]

When you’re satisfied, choose File > Save, and specify a name and location for your new bordering utility. The Applications folder is as good a place as any. An easy way to use your new homegrown utility is to put it in the Dock, and then drag your images onto it. You could also put it in the toolbar of Finder windows, or do what Adam Engst does, and activate it via a keyboard shortcut (courtesy of Keyboard Maestro) after selecting a screenshot file on the Desktop.

For more on Automator, Keyboard Maestro, and automating your Mac in general, see Joe’s other recently updated book, “Take Control of Automating Your Mac [6].”

[1]: http://tidbits.com/resources/2015-04/Drop-shadow-example.png
[2]: http://tid.bl.it/tco-command-line-tidbits
[3]: http://tidbits.com/article/13532
[4]: http://belightcommunity.free.fr/display_file.php?id=46
[5]: http://tidbits.com/resources/2015-04/Automator-add-border.png
[6]: http://tid.bl.it/tco-automating-your-mac-tidbits