ImageSequence Module
The ImageSequence
module contains a wrapper class that lets youiterate over the frames of an image sequence.
Extracting frames from an animation
- from PIL import Image, ImageSequence
- im = Image.open("animation.fli")
- index = 1
- for frame in ImageSequence.Iterator(im):
- frame.save("frame%d.png" % index)
- index = index + 1
The Iterator class
- class
PIL.ImageSequence.
Iterator
(im)[源代码] - This class implements an iterator object that can be used to loopover an image sequence.
You can use the []
operator to access elements by index. This operatorwill raise an IndexError
if you try to access a nonexistentframe.
参数:im – An image object.
当前内容版权归 pillow-zh-cn 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 pillow-zh-cn .