Skip to content

Instantly share code, notes, and snippets.

@joshdick
Created October 10, 2013 14:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joshdick/6919331 to your computer and use it in GitHub Desktop.
Save joshdick/6919331 to your computer and use it in GitHub Desktop.
Forecast.io Snapshot
#!/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
@joshdick
Copy link
Author

More information about this script is available at: http://blog.joshdick.net/2013/10/10/forecast.io_weather_on_the_mac_desktop.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment