Skip to content

Commit 2656f2f

Browse files
AozoraYuipre-commit-ci[bot]MeetWq
authored
add meme rip_clothes (#265)
* 表情新增:撕衣服 * style: auto fix by pre-commit hooks * adjust --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: meetwq <meetwq@gmail.com>
1 parent d4046f2 commit 2656f2f

17 files changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from datetime import datetime
2+
from pathlib import Path
3+
4+
from pil_utils import BuildImage
5+
6+
from meme_generator import add_meme
7+
from meme_generator.utils import FrameAlignPolicy, Maker, make_gif_or_combined_gif
8+
9+
img_dir = Path(__file__).parent / "images"
10+
11+
12+
def rip_clothes(images: list[BuildImage], texts, args):
13+
def maker(i: int) -> Maker:
14+
def make(imgs: list[BuildImage]) -> BuildImage:
15+
img = imgs[0].convert("RGBA").resize((480, 270), keep_ratio=True)
16+
if i <= 15:
17+
frame = BuildImage.open(img_dir / f"{i}.png")
18+
frame.paste(img, (0, 0), below=True)
19+
return frame
20+
else:
21+
return img
22+
23+
return make
24+
25+
return make_gif_or_combined_gif(
26+
images, maker, 20, 0.1, FrameAlignPolicy.extend_last
27+
)
28+
29+
30+
add_meme(
31+
"rip_clothes",
32+
rip_clothes,
33+
min_images=1,
34+
max_images=1,
35+
keywords=["撕衣服"],
36+
date_created=datetime(2025, 5, 7),
37+
date_modified=datetime(2025, 6, 3),
38+
)
68 KB
Loading
70 KB
Loading
70 KB
Loading
60.9 KB
Loading
60.8 KB
Loading
14.1 KB
Loading
3.69 KB
Loading
1.42 KB
Loading
70 KB
Loading

0 commit comments

Comments
 (0)