Let me save the next person some trouble: The Python Imaging Library (PIL 1.1.5) does not support writing animated GIFs.
Update: A script that has been published may help. See comments.
It was suggested to me that my previous post needed a few diagrams to explain the concepts. I thought about it the number of dimensions I was trying to explain, and decided that some simple machine-generated animations were probably the way to go here.
When I hear machine-generated images, I think of the Python Imaging Library. It has proven to be a very powerful tool on a number of small-to-medium toy projects that I have attempted.
I imagined that I would write a hundred or so lines of Python code that would spit out images of intersections in various states of traffic flow, and I would combine them together in a sequence to produce a a few animated GIFs, and then link the GIFs into appropriate places in the article.
The GIF formats also include some metadata, which appears to be only partially supported by PIL 1.1.5. I found that the
Image.info() method included “duration” and “loop” fields. The May 6, 2005 draft of the next PIL handbook describes the “duration” field only.
However, PIL 1.1.5 can only write to GIF87a. It cannot write to GIF89a. Therefore, it can’t be used to produce GIF89a animations.
I do not believe it can even be used to create new GIF87a sequences. (I can’t find any suitable methods.) I believe it can be used to edit existing (but useless?) GIF87a sequences, but I haven’t tested this.
In 1997, in an online thread titled: “Can PIL handle animated GIFs?” appeared to suggest yes. I couldn’t find the referenced example code, but it seems to be a limited “yes”, and consistent with the restrictions above.
The only thing that let me down was… the damn PIL. An imaging library that has some of the worst GIF support I’ve yet seen. Yes, I know all about the GIF patent issues, but de-emphasising support for a de-facto standard because of ideological convictions doesn’t work in the real world.
He suggests some alternatives. (BTW, Ben, knolp!)
Update: A script, described in the comments below, may help people looking to work-around this missing feature.