Hi Guy's hope you can help, I would like to use an animated gif downloaded from weather underground on my raspberry pi to be displayed on my PiTFT screen. I hunted around for a couple of days looking for a suitable viewer without much luck, I have since discovered mplayer can play animated gifs and display it on the Adafruit PiTFT screen and works nicely with a 5 step animation. The current issue I am having is getting it to loop the gif until an interupt is used.

to display the gif i use this code

    mplayer -vo fbdev2:/dev/fb1 -x 240 -y 320 -framedrop newcastle.gif

I have tried using the inbuilt -loop command but have no joy. If looping an animated gif via mplayer is not possible, then could i effectively reload the image within the same command if yes hdw.

any help / advice greatly appreciated.

also posted on raspberry pi.org but nothing forth coming from there as yet. Many Thanks Tony


instead of using mplayer to loop the gif, recompile the gif to loop on its own.

First, make the gif into a series of images.

$convert someGIF.gif *.jpeg

youll then have a bunch of jpegs. you can use a variety of image extensions. I used jpeg, but gif, png, tiff, and others may works as well. next, recompile the images into an infinitely looping gif. convert -delay 20 -loop 0 *.jpg some.gif

the convert command is part of imagemagick, which has loads of helpful image processing tools. (if it happens that you do not have it installed already) your new gif will now loop infinitely in whatever application you choose to view it in.

And here is a simple tutorial on converting images back into animated gifs with infinite loops. http://www.tjhsst.edu/~dhyatt/supercomp/n401a.html

  • 1
    Brilliant - thank you for that, I will have a good read and play about later today :) – Tony Gray Aug 5 '14 at 8:14
  • Don't convert your frames into a lossy format like jpeg. This is going to significantly increase the output file size and also lose quality compared to the original. – Wyatt8740 Feb 1 '18 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.