Skip to content

Commit

Permalink
add behead
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetWq committed Jul 1, 2023
1 parent 35f0eae commit b13654c
Show file tree
Hide file tree
Showing 22 changed files with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions memes/behead/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from pathlib import Path
from typing import List

from meme_generator import add_meme
from meme_generator.utils import save_gif
from PIL.Image import Image as IMG
from pil_utils import BuildImage

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


def behead(images: List[BuildImage], texts, args):
img = images[0].convert("RGBA").square().resize((75, 75))
# fmt: off
locs = [
(80, 72, 0), (83, 73, 0), (82, 73, 0),
(78, 73, 0), (72, 74, 0), (72, 75, 0),
(73, 76, 0), (73, 76, 0), (73, 76, 0),
(74, 76, 0), (74, 76, 0), (70, 73, 12),
(61, 62, 25), (49, 40, 45), (46, 30, 65),
(50, 35, 85), (39, 34, 105), (19, 45, 135),
(9, 91, 155), (6, 161, 175), (-4, 248, 180),
]
# fmt: on
frames: List[IMG] = []
for i in range(21):
frame = BuildImage.open(img_dir / f"{i}.png")
x, y, angle = locs[i]
frame.paste(img.rotate(angle, expand=True), (x, y), below=True)
frames.append(frame.image)
return save_gif(frames, 0.05)


add_meme("behead", behead, min_images=1, max_images=1, keywords=["砍头", "斩首"])
Binary file added memes/behead/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 memes/behead/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 memes/behead/images/10.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 memes/behead/images/11.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 memes/behead/images/12.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 memes/behead/images/13.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 memes/behead/images/14.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 memes/behead/images/15.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 memes/behead/images/16.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 memes/behead/images/17.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 memes/behead/images/18.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 memes/behead/images/19.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 memes/behead/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.
Binary file added memes/behead/images/20.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 memes/behead/images/3.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 memes/behead/images/4.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 memes/behead/images/5.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 memes/behead/images/6.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 memes/behead/images/7.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 memes/behead/images/8.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 memes/behead/images/9.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 b13654c

Please sign in to comment.