Erik wanted some help with getting a piece of an animated gif to show up in his conky (Conky Help::Tips, Tricks & Scripts::CrunchBang Forums.)

Now I liked that idea very much so came up with this:

First I created a directory ~/.conky/radar/  (for the temp.gif).
Then the knmiradar.sh: (chmod it +x)


#!/bin/bash
#
# Erik
# 2010-07-31
# iggikoopa and pieter
# adjust the paths to your own liking!
#

# Enter the name of the radar GIF image you want to download:
RADARIMAGEURL="http://www.knmi.nl/neerslagradar/images/meest_recente_radarloop451.gif"
RADARIMAGE="meest_recente_radarloop451.gif"

# Download the GIF file:
wget -q -N -t 1 "$RADARIMAGEURL" # quiet, timestamping, 1 retry

# Split the file, leave only the last frame. This might be tricky, because the
# frames seem to share one background frame...

# convert the gif to the right colors so we can do something with it.
gifsicle --colors=255 "$RADARIMAGE" > /home/pieter/.conky/radar/temp.gif
# make them B&W (I like it that way)
gifsicle --use-col=bw /home/pieter/.conky/radar/temp.gif > /home/pieter/.conky/radar/tempbw.gif
# For greyscale:
# gifsicle --dither --use-col=bw /home/pieter/.conky/radar/temp.gif > /home/pieter/.conky/radar/tempbw.gif
# grab the last animated gif and make a stilt image of it.
gifsicle -U /home/pieter/.conky/radar/tempbw.gif "#-1" > /home/pieter/.conky/radar/radar.gif

# if you want to keep the colors then comment above and uncomment these:
#gifsicle --colors=255 "$RADARIMAGE" > /home/pieter/.conky/radar/temp.gif
#gifsicle -U /home/pieter/.conky/radar/temp.gif "#-1" > /home/pieter/.conky/radar/radar.gif

Then in Conky:
add variable:
imlib_cache_size 0

and use this (dont forget to edit the path):


${texeci 300 /home/pieter/.conky/knmiradar.sh}
${image /home/pieter/.conky/radar/radar.gif -p 50,15 -s 125x125}

Works great here…