1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
U
T±dœã@sGdd„dƒZddd„ZdS)c@s0eZdZdZdd„Zdd„Zdd„Zdd    „Zd
S) ÚIteratora-
    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 :py:exc:`IndexError` if you try to access a nonexistent
    frame.
 
    :param im: An image object.
    cCs0t|dƒsd}t|ƒ‚||_t|jddƒ|_dS)NÚseekzim must have seek methodZ
_min_frameé)ÚhasattrÚAttributeErrorÚimÚgetattrÚposition)ÚselfrÚmsg©r úHd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\PIL/ImageSequence.pyÚ__init__s
 
zIterator.__init__c
CsBz|j |¡|jWStk
r<}z
t|‚W5d}~XYnXdS©N)rrÚEOFErrorÚ
IndexError)r    ÚixÚer r r Ú __getitem__&s
 zIterator.__getitem__cCs|Srr )r    r r r Ú__iter__-szIterator.__iter__c
CsRz$|j |j¡|jd7_|jWStk
rL}z
t|‚W5d}~XYnXdS)Né)rrrrÚ StopIteration)r    rr r r Ú__next__0s zIterator.__next__N)Ú__name__Ú
__module__Ú __qualname__Ú__doc__r rrrr r r r rs
 rNcs`t|tƒs|g}g}|D],}| ¡}|dd„t|ƒDƒ7}| |¡qˆr\‡fdd„|DƒS|S)a
    Applies a given function to all frames in an image or a list of images.
    The frames are returned as a list of separate images.
 
    :param im: An image, or a list of images.
    :param func: The function to apply to all of the image frames.
    :returns: A list of images.
    cSsg|] }| ¡‘qSr )Úcopy)Ú.0Zim_framer r r Ú
<listcomp>Iszall_frames.<locals>.<listcomp>csg|] }ˆ|ƒ‘qSr r )rr©Úfuncr r rLs)Ú
isinstanceÚlistÚtellrr)rr ZimsZ
imSequenceÚcurrentr rr Ú
all_frames9s    
 r%)N)rr%r r r r Ú<module>s&