Created
October 10, 2013 14:31
-
-
Save joshdick/6919331 to your computer and use it in GitHub Desktop.
Forecast.io Snapshot
This file contains hidden or 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 | |
# Forecast.io Snapshot | |
# | |
# Creates a snapshot of forecast.io embeds (http://blog.forecast.io/forecast-embeds/) | |
# for display on the desktop via GeekTool/Nerdtool. | |
# | |
# by Josh Dick - http://joshdick.net | |
# | |
# This script depends on: | |
# | |
# * webkit2png - http://www.paulhammond.org/webkit2png/ | |
# * imagemagick - http://www.imagemagick.org/ | |
# | |
# Both dependencies can be installed on OS X via Homebrew - http://brew.sh/ | |
# Change the following variables to your liking. | |
FONT=Helvetica # Name of a font installed on your system. | |
LATITUDE=42.358431 | |
LONGITUDE=-71.059773 | |
DISPLAY_NAME=Boston,%20MA # Can be any URL encoded string; won't affect weather data. | |
# Take a screenshot of forecast.io embeds and save it to /tmp/weather-full.png | |
webkit2png -F --transparent --delay=5 --filename weather --dir /tmp "http://forecast.io/embed/#lat=$LATITUDE&lon=$LONGITUDE&name=$DISPLAY_NAME&font=$FONT" > /dev/null | |
# Process the screenshot with ImageMagick: | |
# Invert colors, brighten, then add drop shadow. | |
convert /tmp/weather-full.png \ | |
-negate \ | |
-modulate 150 \ | |
\( +clone -background black -shadow 80x3+5+5 \) +swap -background none -layers merge +repage \ | |
/tmp/weather-full.png > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More information about this script is available at: http://blog.joshdick.net/2013/10/10/forecast.io_weather_on_the_mac_desktop.html