# Loop animated .gif in python mode

**URL:** https://discourse.processing.org/t/loop-animated-gif-in-python-mode/30479
**Category:** Processing.py
**Created:** [June 3, 2021, 5:25pm UTC](https://discourse.processing.org/t/loop-animated-gif-in-python-mode/30479 "2021-06-03T17:25:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![JSGauthier](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jsgauthier/32/9910_2.png) [@JSGauthier](https://discourse.processing.org/u/JSGauthier)
#### Post date: [June 3, 2021, 5:25pm UTC](https://discourse.processing.org/t/loop-animated-gif-in-python-mode/30479/1 "2021-06-03T17:25:50Z")

</div>

Hello,

Is there a way to sequence all frames from an animated .gif (in a loop) in python mode?

I would like to run my .gifs without having to load each frame as a seperate file in the /data folder.

Thanks.

> please format code with \</\> button \* [homework policy](https://discourse.processing.org/faq/#homework) \* [asking questions](https://discourse.processing.org/t/2147)

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [June 3, 2021, 6:33pm UTC](https://discourse.processing.org/t/loop-animated-gif-in-python-mode/30479/2 "2021-06-03T18:33:43Z")

</div>

YES!

> [@Using gifAnimation library on Python Mode](https://discourse.processing.org/t/using-gifanimation-library-on-python-mode/24577):
>
> I have answered this today on Stack Overflow and I think it might be useful for someone: Just to be clear about libraries with Processing Python mode: You can use “pure Python” libraries; You can’t use Python libraries with C extensions & etc (like numpy); You can’t use JavaScript (or p5js) libraries; You can use Java & Processing Java mode libraries (most of them work)! Art Simon has a nice example of gifAnimation export here: [https://github.com/APCSPrinciples/AnimatedGIF/](https://github.com/APCSPrinciples/AnimatedGIF/) A step by step a…

---

<div class="post-metadata">

### Author: ![JSGauthier](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jsgauthier/32/9910_2.png) [@JSGauthier](https://discourse.processing.org/u/JSGauthier)
#### Post date: [June 3, 2021, 9:12pm UTC](https://discourse.processing.org/t/loop-animated-gif-in-python-mode/30479/3 "2021-06-03T21:12:32Z")

</div>

> [@Using gifAnimation library on Python Mode](https://discourse.processing.org/t/using-gifanimation-library-on-python-mode/24577/1):
>
> `gifAnimation` (Mac/Windows)

Thank you villares,  
This is exactly what I was seeking.

A note on the STEP 2 of the instruction above:

In order for the library to install correctly ensure you **rename the unzipped** Folder from _/gif-animation-3.0_ to **/gifAnimation**

I made a simple python example using the included “lavalamp.gif” file for anyone interested.

```auto
// JSGauthier
// Make a .gif loop using the gifAnimation library in python mode.

add_library('gifAnimation')

def setup():
    size(1000,1000)
    global G
    G = Gif(this, "lavalamp.gif")

def draw():
    background(0)
    G.loop()
    imageMode(CENTER)
    image(G, mouseX,mouseY)

```
