Skip to content

Commit

Permalink
fix some stuff with files
Browse files Browse the repository at this point in the history
  • Loading branch information
schorrm committed Apr 7, 2023
1 parent 4619308 commit 56cd5d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from contextlib import suppress
import warnings
import json
from io import BytesIO


from bidi.algorithm import get_display

Expand Down Expand Up @@ -320,9 +322,10 @@ def process_time_directive(time: Time) -> Time:
frames = meme.generate_gif()
base = frames[0]
base.info = meme.image.info
base.save('_tmp_gen.gif', save_all=True,
stream = BytesIO()
base.save(stream, format='gif', save_all=True,
append_images=frames[1:])
im = Image.open('_tmp_gen.gif')
im = Image.open(stream)
return im

else:
Expand Down
2 changes: 2 additions & 0 deletions src/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def memestr_to_img(memestr: str):

elif img.is_animated:
filename = os.path.join(os.getcwd(), args.outputfile)
if filename.endswith('.png'):
filename = filename.removesuffix('.png') + '.gif'
info = img.info
info['comment'] = f'memesource: {memestr}'
img.save(filename, save_all=True)
Expand Down

0 comments on commit 56cd5d9

Please sign in to comment.