fd
This commit is contained in:
parent
3a649eff03
commit
6f8cccc6ec
1 changed files with 27 additions and 2 deletions
|
@ -15,8 +15,8 @@ def upload_ibb(file=None, resize=False):
|
||||||
|
|
||||||
if file: file.save("image.webp")
|
if file: file.save("image.webp")
|
||||||
|
|
||||||
i = IImage.open("image.webp")
|
|
||||||
if resize:
|
if resize:
|
||||||
|
i = IImage.open("image.webp")
|
||||||
size = 100, 100
|
size = 100, 100
|
||||||
frames = ImageSequence.Iterator(i)
|
frames = ImageSequence.Iterator(i)
|
||||||
|
|
||||||
|
@ -34,7 +34,32 @@ def upload_ibb(file=None, resize=False):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
return
|
return
|
||||||
i.save("image.webp", format='WEBP', save_all=True)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
sequence = []
|
||||||
|
im = Image.open("image.webp")
|
||||||
|
for frame in ImageSequence.Iterator(im):
|
||||||
|
sequence.append(frame.copy())
|
||||||
|
|
||||||
|
sequence[0].save("image.webp", save_all=True, append_images = sequence[1:])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open("image.webp", 'rb') as f:
|
with open("image.webp", 'rb') as f:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue