Skip to content

Commit

Permalink
jerk off (#17)
Browse files Browse the repository at this point in the history
* Create image folder

* Add files via upload

* Add files via upload

* Delete memes/jerk/images/.gitkeep

* 🚨 auto fix by pre-commit hooks

* adjust

* rename

---------

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 Aug 4, 2024
1 parent 81bde3e commit 39e10f8
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions memes/jerk_off/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from pathlib import Path

from meme_generator import add_meme
from meme_generator.utils import FrameAlignPolicy, Maker, make_gif_or_combined_gif
from pil_utils import BuildImage

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


def jerk_off(images: list[BuildImage], texts, args):
jerk_w, jerk_h = BuildImage.open(img_dir / "0.png").size
img_w, img_h = images[0].size
if img_w / img_h > jerk_w / jerk_h:
frame_h = jerk_h
frame_w = round(frame_h * img_w / img_h)
else:
frame_w = jerk_w
frame_h = round(frame_w * img_h / img_w)

def maker(i: int) -> Maker:
def make(img: BuildImage) -> BuildImage:
frame = img.convert("RGBA").resize((frame_w, frame_h), keep_ratio=True)
jerk = BuildImage.open(img_dir / f"{i}.png")
frame.paste(jerk, ((frame_w - jerk_w) // 2, frame_h - jerk_h), alpha=True)
return frame

return make

return make_gif_or_combined_gif(
images[0], maker, 8, 0.1, FrameAlignPolicy.extend_loop
)


add_meme("jerk_off", jerk_off, min_images=1, max_images=1, keywords=["打胶"])
Binary file added memes/jerk_off/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/jerk_off/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/jerk_off/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/jerk_off/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/jerk_off/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/jerk_off/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/jerk_off/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/jerk_off/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.

0 comments on commit 39e10f8

Please sign in to comment.