forked from rDrama/rDrama
master
parent
2d2828f8db
commit
778f1affac
|
@ -68,9 +68,12 @@ def upload_imgur(filepath=None, file=None, resize=False):
|
||||||
|
|
||||||
if resize:
|
if resize:
|
||||||
i = IImage.open(filepath)
|
i = IImage.open(filepath)
|
||||||
|
format = i.format
|
||||||
|
i = IImage.open(filepath).convert("RGBA")
|
||||||
size = 100, 100
|
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:
|
||||||
new_image = IImage.new("RGBA", frame.size, "WHITE")
|
new_image = IImage.new("RGBA", frame.size, "WHITE")
|
||||||
|
@ -83,7 +86,7 @@ def upload_imgur(filepath=None, file=None, resize=False):
|
||||||
|
|
||||||
om = next(frames)
|
om = next(frames)
|
||||||
om.info = i.info
|
om.info = i.info
|
||||||
filepath = f"image.{i.format}"
|
filepath = f"image.{format}"
|
||||||
try: om.save(filepath, save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30)
|
try: om.save(filepath, save_all=True, append_images=list(frames), loop=0, optimize=True, quality=30)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
Loading…
Reference in New Issue