fd
This commit is contained in:
parent
043e9783f0
commit
359620464e
1 changed files with 6 additions and 5 deletions
|
@ -16,14 +16,15 @@ def upload_ibb(file=None, resize=False):
|
||||||
if file: file.save("image.webp")
|
if file: file.save("image.webp")
|
||||||
|
|
||||||
i = IImage.open("image.webp")
|
i = IImage.open("image.webp")
|
||||||
frames = list(ImageSequence.Iterator(i))
|
frames = ImageSequence.Iterator(i)
|
||||||
|
|
||||||
if resize:
|
|
||||||
def thumbnails(frames):
|
def thumbnails(frames):
|
||||||
for frame in frames:
|
for frame in frames:
|
||||||
|
if resize:
|
||||||
thumbnail = frame.copy()
|
thumbnail = frame.copy()
|
||||||
thumbnail.thumbnail(100, 100, IImage.ANTIALIAS)
|
thumbnail.thumbnail(100, 100, IImage.ANTIALIAS)
|
||||||
yield thumbnail
|
yield thumbnail
|
||||||
|
else: yield frame
|
||||||
|
|
||||||
frames = thumbnails(frames)
|
frames = thumbnails(frames)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue