Created
January 19, 2013 12:37
-
-
Save ramlev/4572457 to your computer and use it in GitHub Desktop.
A little phantomjs shellscript for taking screenshots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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