Skip to content

Commit

Permalink
add meme osu (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgc2333 committed Jul 27, 2023
1 parent 167e475 commit 9441e6f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ dist/
.idea/
venv/
.venv/

result.png
result.jpg
result.gif
41 changes: 41 additions & 0 deletions meme_generator/memes/osu/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from io import BytesIO
from pathlib import Path
from typing import List

from pil_utils import BuildImage

from meme_generator import add_meme
from meme_generator.exception import TextOverLength

img_dir = Path(__file__).parent / "images"


def osu(images, texts: List[str], args) -> BytesIO:
text = texts[0]
frame = BuildImage.open(img_dir / "osu.png")
try:
frame.draw_text(
(80, 80, 432, 432),
text,
max_fontsize=192,
min_fontsize=80,
weight="bold",
fill="white",
allow_wrap=True,
lines_align="center",
fontname="Aller",
)
except ValueError:
raise TextOverLength(text)

return frame.save_png()


add_meme(
"osu",
osu,
min_texts=1,
max_texts=1,
default_texts=["hso!"],
keywords=["osu"],
)
Binary file added meme_generator/memes/osu/images/osu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/fonts/Aller_Bd.ttf
Binary file not shown.

0 comments on commit 9441e6f

Please sign in to comment.