diff --git a/memes/behead/__init__.py b/memes/behead/__init__.py new file mode 100644 index 0000000..7c8c9ce --- /dev/null +++ b/memes/behead/__init__.py @@ -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=["砍头", "斩首"]) diff --git a/memes/behead/images/0.png b/memes/behead/images/0.png new file mode 100644 index 0000000..adcc34c Binary files /dev/null and b/memes/behead/images/0.png differ diff --git a/memes/behead/images/1.png b/memes/behead/images/1.png new file mode 100644 index 0000000..f268f50 Binary files /dev/null and b/memes/behead/images/1.png differ diff --git a/memes/behead/images/10.png b/memes/behead/images/10.png new file mode 100644 index 0000000..258df47 Binary files /dev/null and b/memes/behead/images/10.png differ diff --git a/memes/behead/images/11.png b/memes/behead/images/11.png new file mode 100644 index 0000000..f56c515 Binary files /dev/null and b/memes/behead/images/11.png differ diff --git a/memes/behead/images/12.png b/memes/behead/images/12.png new file mode 100644 index 0000000..d158a5f Binary files /dev/null and b/memes/behead/images/12.png differ diff --git a/memes/behead/images/13.png b/memes/behead/images/13.png new file mode 100644 index 0000000..148c550 Binary files /dev/null and b/memes/behead/images/13.png differ diff --git a/memes/behead/images/14.png b/memes/behead/images/14.png new file mode 100644 index 0000000..e3fb5cb Binary files /dev/null and b/memes/behead/images/14.png differ diff --git a/memes/behead/images/15.png b/memes/behead/images/15.png new file mode 100644 index 0000000..8178c04 Binary files /dev/null and b/memes/behead/images/15.png differ diff --git a/memes/behead/images/16.png b/memes/behead/images/16.png new file mode 100644 index 0000000..613b1cc Binary files /dev/null and b/memes/behead/images/16.png differ diff --git a/memes/behead/images/17.png b/memes/behead/images/17.png new file mode 100644 index 0000000..3f0fcf4 Binary files /dev/null and b/memes/behead/images/17.png differ diff --git a/memes/behead/images/18.png b/memes/behead/images/18.png new file mode 100644 index 0000000..234a1c4 Binary files /dev/null and b/memes/behead/images/18.png differ diff --git a/memes/behead/images/19.png b/memes/behead/images/19.png new file mode 100644 index 0000000..5a0883d Binary files /dev/null and b/memes/behead/images/19.png differ diff --git a/memes/behead/images/2.png b/memes/behead/images/2.png new file mode 100644 index 0000000..03d06f3 Binary files /dev/null and b/memes/behead/images/2.png differ diff --git a/memes/behead/images/20.png b/memes/behead/images/20.png new file mode 100644 index 0000000..470863d Binary files /dev/null and b/memes/behead/images/20.png differ diff --git a/memes/behead/images/3.png b/memes/behead/images/3.png new file mode 100644 index 0000000..f7b2586 Binary files /dev/null and b/memes/behead/images/3.png differ diff --git a/memes/behead/images/4.png b/memes/behead/images/4.png new file mode 100644 index 0000000..c27a1a6 Binary files /dev/null and b/memes/behead/images/4.png differ diff --git a/memes/behead/images/5.png b/memes/behead/images/5.png new file mode 100644 index 0000000..530137f Binary files /dev/null and b/memes/behead/images/5.png differ diff --git a/memes/behead/images/6.png b/memes/behead/images/6.png new file mode 100644 index 0000000..2137c61 Binary files /dev/null and b/memes/behead/images/6.png differ diff --git a/memes/behead/images/7.png b/memes/behead/images/7.png new file mode 100644 index 0000000..f746c49 Binary files /dev/null and b/memes/behead/images/7.png differ diff --git a/memes/behead/images/8.png b/memes/behead/images/8.png new file mode 100644 index 0000000..6693f72 Binary files /dev/null and b/memes/behead/images/8.png differ diff --git a/memes/behead/images/9.png b/memes/behead/images/9.png new file mode 100644 index 0000000..781fb89 Binary files /dev/null and b/memes/behead/images/9.png differ