fd
This commit is contained in:
parent
bd61643a84
commit
b2ec0f4920
1 changed files with 4 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue