forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-01-22 20:35:41 +02:00
parent 2569d29928
commit b3afde2926
1 changed files with 4 additions and 4 deletions

View File

@ -5,10 +5,8 @@ import time
def process_image(file=None, filename=None, resize=0): def process_image(file=None, filename=None, resize=0):
if not filename: filename = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' if not filename: filename = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
if file: if file: i = IImage.open(file)
file.save(filename)
i = IImage.open(file)
else: i = IImage.open(filename) else: i = IImage.open(filename)
if resize: if resize:
@ -28,6 +26,8 @@ def process_image(file=None, filename=None, resize=0):
om.save(filename, format="WEBP", save_all=True, append_images=list(frames), loop=0, method=6, allow_mixed=True) om.save(filename, format="WEBP", save_all=True, append_images=list(frames), loop=0, method=6, allow_mixed=True)
elif i.format.lower() != "webp": elif i.format.lower() != "webp":
if i.format.lower() == "gif": if i.format.lower() == "gif":
file.save(filename)
time.sleep(0.1)
gifwebp(input_image=filename, output_image=filename, option="-mixed -metadata none -f 100 -mt -m 6") gifwebp(input_image=filename, output_image=filename, option="-mixed -metadata none -f 100 -mt -m 6")
else: i.save(filename, format="WEBP", method=6) else: i.save(filename, format="WEBP", method=6)