forecast_snapshot.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. # https://gist.github.com/joshdick/6919331
  3. #
  4. # Forecast.io Snapshot
  5. #
  6. # Creates a snapshot of forecast.io embeds (http://blog.forecast.io/forecast-embeds/)
  7. # for display on the desktop via GeekTool/Nerdtool.
  8. #
  9. # by Josh Dick - http://joshdick.net
  10. #
  11. # This script depends on:
  12. #
  13. # * webkit2png - http://www.paulhammond.org/webkit2png/
  14. # * imagemagick - http://www.imagemagick.org/
  15. #
  16. # Both dependencies can be installed on OS X via Homebrew - http://brew.sh/
  17. # Change the following variables to your liking.
  18. FONT=Helvetica # Name of a font installed on your system.
  19. LATITUDE=42.281389
  20. LONGITUDE=-83.748333
  21. DISPLAY_NAME=Ann%20Arbor,%20MI # Can be any URL encoded string; won't affect weather data.
  22. # Take a screenshot of forecast.io embeds and save it to /tmp/weather-full.png
  23. webkit2png -F --transparent --delay=5 --filename weather --dir /tmp "http://forecast.io/embed/#lat=$LATITUDE&lon=$LONGITUDE&name=$DISPLAY_NAME&font=$FONT" > /dev/null
  24. # Process the screenshot with ImageMagick:
  25. # Invert colors, brighten, then add drop shadow.
  26. convert /tmp/weather-full.png \
  27. -negate \
  28. -modulate 150 \
  29. \( +clone -background black -shadow 80x3+5+5 \) +swap -background none -layers merge +repage \
  30. /tmp/weather-full.png > /dev/null