Skip to content

Commit

Permalink
add meme sold_out (#196)
Browse files Browse the repository at this point in the history
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 authored Nov 18, 2024
1 parent 53c1561 commit 6da7510
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions meme_generator/memes/sold_out/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from datetime import datetime
from pathlib import Path

from pil_utils import BuildImage

from meme_generator import add_meme
from meme_generator.utils import make_jpg_or_gif

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


def sold_out(images: list[BuildImage], texts, args):
icon = BuildImage.open(img_dir / "0.png")

def make(imgs: list[BuildImage]) -> BuildImage:
frame = imgs[0].convert("RGBA")
if frame.width > frame.height:
frame = frame.resize_height(600)
else:
frame = frame.resize_width(600)
mask = BuildImage.new("RGBA", frame.size, (0, 0, 0, 64))
frame.paste(mask, alpha=True)
return frame.paste(
icon,
((frame.width - icon.height) // 2, (frame.height - icon.height) // 2),
alpha=True,
)

return make_jpg_or_gif(images, make)


add_meme(
"sold_out",
sold_out,
min_images=1,
max_images=1,
keywords=["卖掉了"],
date_created=datetime(2024, 11, 18),
date_modified=datetime(2024, 11, 18),
)
Binary file added meme_generator/memes/sold_out/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.

0 comments on commit 6da7510

Please sign in to comment.