awips2/pythonPackages/pil/PIL/ImageSequence.py
root 2b462d8665 Initial revision of AWIPS2 11.9.0-7p5
Former-commit-id: 06a8b51d6d [formerly a02aeb236c [formerly 9f19e3f712] [formerly 06a8b51d6d [formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]]
Former-commit-id: a02aeb236c [formerly 9f19e3f712]
Former-commit-id: a02aeb236c
Former-commit-id: 133dc97f67
2012-01-06 08:55:05 -06:00

38 lines
845 B
Python

#
# The Python Imaging Library.
# $Id: ImageSequence.py 2134 2004-10-06 08:55:20Z fredrik $
#
# sequence support classes
#
# history:
# 1997-02-20 fl Created
#
# Copyright (c) 1997 by Secret Labs AB.
# Copyright (c) 1997 by Fredrik Lundh.
#
# See the README file for information on usage and redistribution.
#
##
# This class implements an iterator object that can be used to loop
# over an image sequence.
class Iterator:
##
# Create an iterator.
#
# @param im An image object.
def __init__(self, im):
if not hasattr(im, "seek"):
raise AttributeError("im must have seek method")
self.im = im
def __getitem__(self, ix):
try:
if ix:
self.im.seek(ix)
return self.im
except EOFError:
raise IndexError # end of sequence