mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Changed gifmaker script to use ImageSequence Iterator
This commit is contained in:
parent
40ae907342
commit
6d7eb53b52
|
@ -42,26 +42,10 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
from PIL import Image, ImageChops
|
||||
from PIL import Image, ImageChops, ImageSequence
|
||||
|
||||
from PIL.GifImagePlugin import getheader, getdata
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# sequence iterator
|
||||
|
||||
|
||||
class image_sequence(object):
|
||||
def __init__(self, im):
|
||||
self.im = im
|
||||
|
||||
def __getitem__(self, ix):
|
||||
try:
|
||||
if ix:
|
||||
self.im.seek(ix)
|
||||
return self.im
|
||||
except EOFError:
|
||||
raise IndexError # end of sequence
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# straightforward delta encoding
|
||||
|
||||
|
@ -122,7 +106,7 @@ def compress(infile, outfile):
|
|||
# open output file
|
||||
fp = open(outfile, "wb")
|
||||
|
||||
seq = image_sequence(im)
|
||||
seq = ImageSequence.Iterator(im)
|
||||
|
||||
makedelta(fp, seq)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user