Skip to content

Commit

Permalink
feat: add meme beat_up (#95)
Browse files Browse the repository at this point in the history
* feat: add meme `zou`

* style: auto fix by pre-commit hooks

* rename `zou` to `beat_up`

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: meetwq <[email protected]>
  • Loading branch information
3 people committed Apr 9, 2024
1 parent 52ffd73 commit 0529337
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions meme_generator/memes/beat_up/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from pathlib import Path
from typing import List

from PIL.Image import Image as IMG
from pil_utils import BuildImage

from meme_generator import add_meme
from meme_generator.utils import save_gif

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


def beat_up(images: List[BuildImage], texts, args):
self_head = images[0].convert("RGBA").circle().resize((55, 55))
user_head = images[1].convert("RGBA").circle().resize((45, 45))
self_locs = [(100, 43), (110, 46), (101, 40)]
user_locs = [(99, 136), (99, 136), (89, 140)]
frames: List[IMG] = []
for i in range(3):
frame = BuildImage.open(img_dir / f"{i}.png")
frame.paste(user_head, user_locs[i], alpha=True)
frame.paste(self_head, self_locs[i], alpha=True)
frames.append(frame.image)

return save_gif(frames, 0.1)


add_meme("beat_up", beat_up, min_images=2, max_images=2, keywords=["揍"])
Binary file added meme_generator/memes/beat_up/images/0.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 meme_generator/memes/beat_up/images/1.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 meme_generator/memes/beat_up/images/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0529337

Please sign in to comment.