Skip to content

Instantly share code, notes, and snippets.

@ramlev
Created January 19, 2013 12:37
Show Gist options
  • Save ramlev/4572457 to your computer and use it in GitHub Desktop.
Save ramlev/4572457 to your computer and use it in GitHub Desktop.
A little phantomjs shellscript for taking screenshots
#!/bin/sh
PATH_TO_PHANTOMJS=~/tmp/phantomjs
SCREENSHOT_PATH=~/Desktop
# Check if an url has been added as an arguemnt
if [ -n "$1" ]
then
URL=$1
else
# If not, we're using the argument from the clipboard
URL=`pbpaste`
fi
echo "Taking screenshot of $URL"
echo "Please wait a bit..."
# Execute the command, and save the screenshot to the path defined above
$PATH_TO_PHANTOMJS/bin/phantomjs $PATH_TO_PHANTOMJS/examples/rasterize.js $URL $SCREENSHOT_PATH/scrrenshot-`date +%s`.png
# Open finder in the SCREENSHOT_PATH folder
open $SCREENSHOT_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment