#!/bin/sh -u # # Output a BOM 128km rain radar image in PNG form, usually transparent. # - Cameron Simpson 15jan2007 # : ${TMPDIR:=/tmp} dotrans=1 cmd=`basename "$0"` || exit 1 usage="usage: $cmd [-notrans] image -notrans Do not create transparency of the sea and land. image Image to fetch." badopts= [ $# -gt 0 ] && [ "x$1" = x-notrans ] && { dotrans=; shift; } if [ $# = 0 ] then echo "$cmd: missing image" >&2 badopts=1 else image=$1 shift [ $# -gt 0 ] && { echo "$cmd: extra arguments after image: $*" >&2 badopts=1 } fi [ $badopts ] && { echo "$usage" >&2; exit 2; } case "$image" in http://*) ;; *)image=http://mirror.bom.gov.au/radar/$image?x ;; esac if [ $dotrans ] then tmpf=$TMPDIR/$cmd$$.png trap 'rm -f "$tmpf"' 0 1 2 13 15 else tmpf=png:- fi wget -q -O - "$image" | gm convert GIF:- -crop 512x496+6+22 "$tmpf" || exit 1 [ $dotrans ] || exit 0 bom-radar-trans "$tmpf"