Thoughtful, detailed coverage of the Mac, iPhone, and iPad, plus the TidBITS Content Network for Apple consultants.

How to Eliminate Drop Shadows in OS X Screenshots

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.


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.”

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,” 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, 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.


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.”

 

Backblaze is unlimited, unthrottled backup for Macs at $5/month.
Web access to files means your data is always available. Restore
by Mail allows you to recover files via a hard drive or USB.
Start your 15-day trial today! <https://www.backblaze.com/tb>
 

Comments about How to Eliminate Drop Shadows in OS X Screenshots
(Comments are closed.)

NaplesJerry  2015-04-25 15:54
I know I never did the permanent fix using Terminal. Neither did I hold down the option key when clicking on an experimental Command Shift 4 area

But, my resulting screen shot doesn't show the drop shadow in Quick Look, Preview or when pasted into Text Edit.

I am running 10.10.3

Jerry
NaplesJerry  2015-04-25 16:22
I read the article closer.

I think the Drop shadow is when you use the Camera path. I don't use that

Jerry
Adam Engst  An apple icon for a TidBITS Staffer 2015-04-26 09:24
Yep, the drop shadow only happens when you take a screenshot of an object - a window, dialog, or menu.
Jay Tillman  2015-04-26 07:43
Great article and thanks for the automator action. To make it easier than dragging screenshots to the automator action in the dock, one could use Hazel to look for screenshots on the desktop, move them to a specific folder (and maybe rename them), and then run the automator action to put the grey background on them automatically.
Adam Engst  An apple icon for a TidBITS Staffer 2015-04-26 09:25
Yes, you could, and that would be a great use of Hazel (which is also discussed in Joe's "Take Control of Automating Your Mac"). :-)
gluebyte  2015-04-27 03:28
I cannot find Borders from the menu. Is it a custom Quartz filter?
Adam Engst  An apple icon for a TidBITS Staffer 2015-04-27 10:34
I don't think so, but we've been using it for so long it's possible I'm not remembering right. Hmm, I'm not seeing on our server, which is a clean Yosemite installation, so perhaps not. Investigating further...
Josh Centers  2015-04-27 14:04
It is indeed a custom Quartz filter, as we've discovered. I've updated the article with instructions on how to obtain it.
What about instead of a border, add a white background?

For scientific presentations I often include PDF plots in Keynote documents. The plots are originally EPS so I use epstopdf to get a nice PDF that I drag into Keynote. However, Keynote sees no solid background, so the plots become transparent. Depending on background not what you want. So I then have to manually add a white rectangle, match its size to the figure's, put the plot on top, and group them. It would be great if there were a little drag-and-drop magic (or even a CLI tool) that would simply add a solid white background to these PDFs.
Curtis Wilcox  An apple icon for a Friend of TidBITS 2015-04-28 07:59
First, if you drag an .eps file into Keynote, it'll convert it to a PDF itself on the fly. Preview.app does the same thing when opening EPS files. If you use Preview.app to export the file to PNG, the resulting image will have a white background (which was a little surprising since PNG supports alpha transparency). You can make a drag 'n drop application using Automator; use Render PDF Pages as Images to convert it to PNG then use Move Finder Items to dictate where the resulting file should be placed.
I don't particularly like the PNG workaround. PNGs cannot be scaled like the EPS or PDF vector source. If you later want to blow up a figure, you'd have to go back to the source and create a much higher res PNG, otherwise you're stuck with a blurry figure.
Curtis Wilcox  An apple icon for a Friend of TidBITS 2015-04-29 07:35
Okay, didn't think that would be an issue in Keynote presentations which are low res compared to print. So, time to learn a little PostScript: open the EPS file in a text editor and on a new line before any existing line that contains "setrgbcolor," add the line "1 1 1 setrgbcolor clippath fill." The numbers are RGB values on a scale from 0 to 1.

I just found this from some googling so I don't know anything about the file format. The main thing is for the line to be added before any existing lines that would draw something In the EPS file I downloaded, I inserted the line after "save" on line 17, if that's found in every EPS file a script could match the first instance of the pattern newline save newline then insert 1 1 1 setrgbcolor clippath fill newline and write a new file. I tried putting it on the second line of the file and it worked but that might be considered poor formatting and perhaps something unexpected would happen if you opened it in a graphics editing program.
Thanks. That works for the EPS, however, the PDF you create from that EPS still has a transparent background.
Curtis Wilcox  An apple icon for a Friend of TidBITS 2015-04-29 18:18
It doesn't for me. I add that line to the EPS file, open it in Prevew, then Save the resulting PDF. When I drag the PDF into a Keynote slide, it has the background color. This is with OS X 10.9.5 and Keynote 6.2.2. Maybe it has something to do with the very simple, old EPS file I'm testing with, it's petersen.eps from http://people.sc.fsu.edu/~jburkardt/data/eps/eps.html.
B. Jefferson Le Blanc  2015-04-28 12:06
Great article. I have a hard time remembering all the screenshot shortcuts because I don't use them often enough, but I'll save this article so I can find the info when I need it.

There is no Compositions folder in my user>Library folder, but there is one in the root level Library folder (for all users). I haven't tried it, but you could probably create a folder in your user>Library folder and name it Compositions – which is probably what you did back when you first set up this Automator action. In fact, since you are pointing your action to the folder in any case, you could probably put it anywhere. If there is a system function that relies on the Compositions folder it would look in both libraries for it – I don't recall the default sequence, whether the system looks to the user or root library first, but for most purposes it wouldn't matter.

I don't use Automator much, but for making a quick and easy border it might be worth a try. Thanks again. By the way, I've already bought Joe's e-book on using Terminal, or rather, upgraded to the latest version. Being a regular TidBITS reader I long ago got addicted to Take Control books.

PS: I just set up the Automator action you prescribe here and the note for the Apply Quartz Composition Filter to Image Files explains that the Compositions folder can, indeed, be in either library.

PPS: If you want to be able to open the Automator action to make changes and overwrite or save another version of the bordering app, save a duplicate of the action as a workflow. Then, when you open the workflow action, you'll need to duplicate it again to save a copy, since there is no longer a Save As... function in OS X (I'll forgo my rant on that subject – this time).

For what it's worth, I found Automator to be unstable when overwriting items with the Save operation. What's worse, it didn't save the changes I made to the action. I had to make yet another duplicate for that. And I had to use Activity Monitor to quit Automator when it got hung up below the level that Force Quit can see. Maybe the Yosemite version is more reliable, but I'm still using Mavericks, awaiting reports on the stability of the OS X 10.10.3 update.

In fact, I think that would be a good article for a future issue of TidBITS: has Apple finally got the bugs out of Yosemite.
Josh Centers  2015-05-05 13:03
Thanks for testing, and for the feedback. As for Yosemite bugs, almost all of mine vanished after I performed a clean install.
J. A. Duke  2015-05-05 11:44
Adam & Josh:

What is your preferred tool to capture screenshots of menus?

I’ve been using the built-in Grab, but was wondering if there was something out there to just capture the menu rather than the whole screen (like Command-Shift-4, Spacebar that captures the window that the camera icon is over).

Also, I found the Screenshot Path utility (http://www.mac-attender.com/mac/screenshotpath/) which will let you set a screenshot format and a folder other than the Desktop as the default destination for your screenshots. I’ve corresponded with the developer recently, asking him to add a Remove Shadow option so there’s one tool to take care of all the customizations.

Cheers,
Jon
Josh Centers  2015-05-05 13:01
I use the Command-Shift-4 + Space bar trick to grab menus, though I often don't need to take screenshots of menus themselves.
NaplesJerry  2015-05-05 15:19
Thanks Jon for the link to ScreenShotPath

Question, Once set up is it always active? Or can it be stopped having an effect?

Jerry
J. A. Duke  2015-05-05 15:35
Jerry,

The change is “permanent” in that once ScreenshotPath makes the change, you don’t need to run it again unless you want to change the format or path.

Note, that as far as I can tell, it just is running some terminal commands to perform the magic.

Cheers,
Jon
Adam Engst  An apple icon for a TidBITS Staffer 2016-03-17 17:02
Something we've just realized… Turning off shadows by default is problematic if you want to take a screenshot of the entire screen showing a dialog, for instance, since then the dialog won't have the shadow and will look weird. So we're going back to the Option-click trick to remove shadows from standalone dialogs and windows.