forked from rDrama/rDrama
master
parent
3d10c50fb8
commit
56c2638dea
|
@ -15,16 +15,16 @@ def upload_ibb(file=None, resize=False):
|
||||||
|
|
||||||
if file: file.save("image.webp")
|
if file: file.save("image.webp")
|
||||||
|
|
||||||
|
if resize:
|
||||||
i = IImage.open("image.webp")
|
i = IImage.open("image.webp")
|
||||||
|
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:
|
||||||
if resize:
|
|
||||||
thumbnail = frame.copy()
|
thumbnail = frame.copy()
|
||||||
thumbnail.thumbnail(100, 100, IImage.ANTIALIAS)
|
thumbnail.thumbnail(size, IImage.ANTIALIAS)
|
||||||
yield thumbnail
|
yield thumbnail
|
||||||
else: yield frame
|
|
||||||
|
|
||||||
frames = thumbnails(frames)
|
frames = thumbnails(frames)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue