How to take a screenshot without the shadow behind it

screen capture

If I take a screenshot with Shift ⇧ + Command ⌘ + 4 + Space, then I get one of the two images:
blue-with-focus
blue-wo-focus

Either way the saved image is surrounded by the shadow halo. I could then edit it out by hand (using Preview) to discard the shadow, or I could use Shift ⇧ + Command ⌘ + 4 and try to pinpoint the boundary by hand, but neither lets me get a pixel-perfect boundary easily.

Is there a convenient way to save a window without its shadow?

Best Answer

You can disable the shadow added when capturing an entire window by executing the following command from the Terminal:

defaults write com.apple.screencapture disable-shadow -bool TRUE

You'll need to reboot or restart the UIServer for the changes to take effect:

killall SystemUIServer

You can undo this preference and re-enable shadows by executing the following:

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