Skip to content

Instantly share code, notes, and snippets.

@tempelmann
Last active August 29, 2022 16:17
Show Gist options
  • Save tempelmann/d816634c805ab82ed0509bd879a6a83f to your computer and use it in GitHub Desktop.
Save tempelmann/d816634c805ab82ed0509bd879a6a83f to your computer and use it in GitHub Desktop.
An Acorn (macOS) script to add a drop shadow to screenshots of shadow-less windows
-- This script uses Acorn (tested with version 6.6.4)
-- to add a light border around a window screenshot.
--
-- Screenshots (without the huge macOS shadows) are made by shift-cmd-4, then space bar,
-- then option-click on window (see https://apple.stackexchange.com/a/120017/17533)
--
-- Before use, you need to create a Preset Filter for this, once:
-- With an image opened, use from menu: Filter / Stylize / Drop Shadow…
-- Set its options as you prefer (e.g. X/Y offset 0, Blur Radius 2, Opacity 80%),
-- then save it by clicking the gear icon, choose "Save Filter Preset…" and
-- name it: Frame Window Screenshot
--
-- To use, open the screenshot in Acorn, then run this script.
--
-- Written 16Apr21 by Thomas Tempelmann, http://apps.tempel.org
tell application "Acorn"
set theDoc to front document
-- increase img size by 2 pixel on each side
set newWidth to (width of theDoc) + 4
set newHeight to (height of theDoc) + 4
resize canvas theDoc width newWidth height newHeight anchor position middle center
-- add a (centered) shadow on all sides
load filter preset theDoc name "Frame Window Screenshot"
do filter theDoc name "Frame Window Screenshot"
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment