fdfd
This commit is contained in:
parent
659f6d8b7c
commit
875e92c6e2
2 changed files with 3 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
|
image.gif
|
||||||
dramacache/
|
dramacache/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|
|
@ -16,12 +16,13 @@ def upload_file(file=None, resize=False):
|
||||||
|
|
||||||
if resize:
|
if resize:
|
||||||
i = IImage.open("image.gif")
|
i = IImage.open("image.gif")
|
||||||
|
size = 100, 100
|
||||||
frames = ImageSequence.Iterator(i)
|
frames = ImageSequence.Iterator(i)
|
||||||
|
|
||||||
def thumbnails(frames):
|
def thumbnails(frames):
|
||||||
for frame in frames:
|
for frame in frames:
|
||||||
thumbnail = frame.copy()
|
thumbnail = frame.copy()
|
||||||
thumbnail.thumbnail(100, 100, IImage.ANTIALIAS)
|
thumbnail.thumbnail(size, IImage.ANTIALIAS)
|
||||||
yield thumbnail
|
yield thumbnail
|
||||||
|
|
||||||
frames = thumbnails(frames)
|
frames = thumbnails(frames)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue