ImageSequence Module

The ImageSequence module contains a wrapper class that lets you iterate over the frames of an image sequence.

Extracting frames from an animation

from PIL import Image, ImageSequence

im ="animation.fli")

index = 1
for frame in ImageSequence.Iterator(im):"frame%d.png" % index)
    index = index + 1

The Iterator class

class PIL.ImageSequence.Iterator(im)[source]

This class implements an iterator object that can be used to loop over an image sequence.

You can use the [] operator to access elements by index. This operator will raise an IndexError if you try to access a nonexistent frame.

参数:im – An image object.




你可以从IRC频道获取实时帮助: irc://。你也可以使用邮件列表: Image-SIG mailing list。当然还可以去 Stack Overflow

如果你发现了Bug,可以去 Github提交issues。