I'd like to be able to add torn edges to images in the clipboard on my Mac. I do a lot of documentation and having the ability to add a torn edge around a screen shot helps the people that try to click the button in the screenshots understand that its an image of the button, not the button itself...

I used Greenshot on Windows but now I've moved to Mac I've found that greenshot on Mac just lacks too many features so I'm now using Shottr which has all the features I need except torn edge.

'Torn edge' adds a border to the image to make it look like its been torn from a larger sheet of paper. In greenshot it looks like the image on this page: https://getgreenshot.org/2014/12/22/a-little-present-from-us-greenshot-1-2/

or this image


In Pages it looks like this https://discussions.apple.com/thread/4741142?sortBy=best

I have looked at using imagemagick or Pages along with automator to automatically create a copy of the image in a subfolder of 'screenshots' that has the effect applied but being new to scripting on this mac I'm not even sure what words to put into google to search.

Any pointers on where to start would be appreciated. If there is a javascript solution that might also work as I also use CopyQ which can process the clipboard contents using ECMAScript

Is this something that can be automated?

  • 2
    Welcome to Ask Different. There are many automation wizards here, but they might not understand what the effect you see as "torn edges" is without an example linked or edited into the question. Pages is fully scriptable, so perhaps editing that out will let people focus on your issue and not some misconceptions. Excellent work documenting your search otherwise!
    – bmike
    Commented Mar 21 at 13:35

1 Answer 1


I don't believe there's a law against giving half an answer so I'll do that in the hope that someone else knows the other half and will "chip in".

You can install ImageMagick on macOS by installing Homebrew, if you don't already have that, then:

brew install imagemagick

To make a torn-edges effect, I think it is easiest to just make the edges invisible using an alpha/transparency mask. Here is one, and you can find loads by going on any photography site and looking for "copyright-free borders":

enter image description here

Then take an image - I am using one I shot of "Red Top Mountain State Park" as below:

enter image description here

You can then use the following command to:

  • load the image
  • note its size in dims variable
  • load the border and resize to match the dimensions of the original
  • copy that border into the original image's alpha channel to make the black parts transparent

magick "Red Top Mountain.jpg"  -set option:dims "%[fx:w]x%[fx:h]" \
      \( torn.png -resize '%[dims]!' \)                           \
      -compose copyopacity -composite result.png

enter image description here

So, the "only" remaining part is getting your image off the clipboard, running it through the script and getting the result back onto the clipboard.

Naïvely, you would make a bash script called $HOME/tear.sh and make it executable with:

chmod +x $HOME/tear.sh

Then you could just type the following in your Terminal, or make a simple shell command on your Desktop:


The script would look something like this:


# Paste the clipboard contents onto stdout, read into ImageMagick adding torn edges and output as PNG back onto clipboard
pbpaste | magick -  -set option:dims "%[fx:w]x%[fx:h]"   \
      \( "$HOME/torn.png" -resize '%[dims]!' \)          \
      -compose copyopacity -composite PNG:- | pbcopy

But that doesn't work because it is not so easy copying and pasting images into the clipboard.

I may be getting a little closer... it seems I can cobble together some osascript to save the clipboard as a PNG file in /tmp like this:


# Save clipboard as PNG in /tmp
osascript <<EOF
set theFile to (open for access POSIX file "/tmp/clipboard.png" with write permission)
  write (the clipboard as «class PNGf») to theFile
end try
close access theFile

# Read clipboard from /tmp into ImageMagick adding torn edges and output as PNG back onto clipboard
magick /tmp/clipboard.png  -set option:dims "%[fx:w]x%[fx:h]" \
      \( "$HOME/torn.png" -resize '%[dims]!' \)               \
      -compose copyopacity -composite PNG:- | pbcopy
  • 1
    We love answers like this - well done! Explaining part of the process, letting others collaboratively build upon a key component of the solution is excellent. Even wrong answers can help if they explain why something doesn’t work, provoke learning or discussion.
    – bmike
    Commented Jun 12 at 9:10
  • For the smaller half of the answer, maybe a folder action that uses your code to add the torn edge effect to screenshots, then recopies them to the clipboard? Not sure how long folder actions will be supported long term though, as I've heard various rumours about AppleScript being killed off at some point. Commented Jun 12 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .