1234567891011121314151617181920212223242526272829303132333435 |
- #!/bin/sh
- # https://gist.github.com/joshdick/6919331
- #
- # 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.281389
- LONGITUDE=-83.748333
- DISPLAY_NAME=Ann%20Arbor,%20MI # 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
|