Search code examples
python-3.xprocessinggifglob

Creating GIF but cannot see filenames os glob


Goal: export this output as a GIF.

This is working code, using Processing and Python.

I am stuck with reading the image filenames to create a GIF.

I downloaded gif-animation-3.0 and placed it in libraries folder.


Attempted Solution:

import random
import glob
import os

add_library('gif-animation-3.0')
radius = 0

def setup():
    global displayWidth, displayHeight, radius, num_frames
    size(displayWidth, displayHeight)
    background(0)
    noFill()
    stroke(255, 0, 0, 10)
    radius = height / 2
    num_frames = 0
    
    global exporter
    size(400, 400)
    exporter = GifMaker(this, 'Examples/spiral-waves.gif')
    exporter.setRepeat(0)     # infinite repeat
    exporter.setQuality(100)  # test values
    exporter.setDelay(200)    # milliseconds 
    
def draw():
    global num_frames
    num_frames += 1
    print(num_frames)
    global radius
    center_x = width / 2
    center_y = height / 2
    
    beginShape()
    for i in range(360):
        _noise = noise(i * 0.02, float(frameCount) / 50)
        x = center_x + radius * cos(radians(i)) * _noise
        y = center_y + radius * sin(radians(i)) * _noise
        curveVertex(x, y)
        
        if radius == 0:
            stroke(0, 0, 225, 25) # Blue
        if radius == 100:
            stroke(0, 225, 0, 25) # Green
        if radius == 200:
            stroke(225, 0, 0, 10) # Red
            
    endShape(CLOSE)
    radius -= 1
    saveFrame('####.png')
    
    if num_frames == 10:
        noLoop()
        exporter.addFrame()
        exporter.finish()

Console:

Maybe there's an unclosed paren or quote mark somewhere before this line?

Please let me know if there is anything else I should add to post.


Solution

  • pip install gifmaker

    gifmaker -i *.png