Memegen
by @artemiopadilla
Generate meme images using the memegen.link API. Use when the user asks to create, make, send, or generate a meme, funny image, reaction image, or similar re...
clawhub install memegenπ About This Skill
name: memegen description: > Generate meme images using the memegen.link API. Use when the user asks to create, make, send, or generate a meme, funny image, reaction image, or similar request. Produces meme images via URL β no local image generation needed. Supports 100+ classic meme templates (Drake, Doge, Disaster Girl, Expanding Brain, etc.) and custom backgrounds.
Memegen Skill
Generate memes via the memegen.link public API + Imgflip trending templates. No API key required.
Architecture
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββ
β Template Source ββββββΆβ Caption Engine ββββββΆβ Renderer β
β β β β β β
β β’ Built-in IDs β β β’ Manual text β β β’ memegen β
β β’ Imgflip API β β β’ Agent-picked β β .link β
β β’ Custom URL β β β β β’ Pillow β
β β’ Top 30 fallbackβ β β β (local) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββ
How It Works
Memes are generated entirely via URL β no POST requests needed. Build the URL and download the image.
URL Format
https://api.memegen.link/images/{template}/{top_text}/{bottom_text}.png
Downloading Memes
memegen.link returns HTTP 404 status but valid image body β many HTTP clients reject 404 URLs.
Always download first, then verify:
curl -s -o /tmp/meme.png "https://api.memegen.link/images/drake/top/bottom.png"
file /tmp/meme.png # Should say "PNG image data"
ls -la /tmp/meme.png # Should be >10KB for a real meme
If the file is empty or <1KB, the template ID is probably wrong.
URL Encoding Rules
| Character | Encoding | Example |
|-----------|----------|---------|
| Space | _ | hello_world |
| ? | ~q | why~q |
| / | ~s | yes~sno |
| # | ~h | tag~h1 |
| % | ~p | 100~p |
| " | '' | he_said_''hi'' |
| _ (literal) | __ | double__underscore |
| Newline | ~n | line1~nline2 |
| Blank line | _ | Top only: /top_text/_ |
Query Parameters
| Param | Type | Description |
|-------|------|-------------|
| background | URL | Custom background image URL |
| width | int | Scale to width (px), use 800 for larger |
| height | int | Scale to height (px) |
| font | string | Font name (see /api/fonts) |
| layout | string | default or top (text positioning) |
| color | string | Text color: HTML name or hex (FF80ED) |
π― VARIETY RULE β Keep It Fresh
Prefer variety over repetition. Before picking a template: 1. Check what templates you've used recently (keep a history if possible) 2. Try to pick a different template from the last 5 memes 3. BUT β if a specific template is clearly the best fit for the joke, use it even if recent 4. After generating, log the template used for future reference
Humor Configuration
This skill includes a humor profile system β an equalizer for meme tone, darkness, and cultural targeting. See humor-profiles.md for the full reference.
Default Profile
| Slider | Default | Range | |--------|---------|-------| | Darkness | Level 2 (Light) | 1: Clean β 5: Nuclear β’οΈ | | Dank Meter | Normie-Dank | Normie β Dank β Deep Fried β Surreal β Shitpost | | Style | Contextual (auto-detect) | Sarcasm Β· Absurdist Β· Self-deprecating Β· Deadpan Β· Wholesome Β· Roast Β· Meta Β· Shitpost | | Geo | Neutral | π²π½ MX Β· π¦π· AR Β· πͺπΈ ES Β· πΊπΈ US Β· π§π· BR Β· π¨π΄ CO Β· π LATAM |
How the Same Topic Hits Different
Topic: "My code has bugs"
Level 1 + Wholesome + Normie:
Template: success | "Found a bug / Fixed it on first try"
Level 2 + Sarcasm + Dank:
Template: fry | "Not sure if my code works / Or the tests are just broken too"
Level 3 + Sarcasm + Dank:
Template: fine | "Production is on fire / This is fine, it's a feature"
Level 4 + Deadpan + Dank (π²π½):
Template: harold | "Cuando dices 'ya casi queda' y llevas 3 horas / Pero sonrΓes porque el deploy es maΓ±ana"
Level 5 + Shitpost + Deep Fried:
Template: custom deep-fried | "BRUH THE CODE πππ / IT COMPILES THO π€π₯π―"
Usage in Prompts
Generate a meme about [topic].
Humor profile: Level 3, Dank, Sarcasm, π²π½
Or let the agent auto-detect from context (language used, group chat culture, conversation tone).
Deep Fry Post-Processing
For Level 5 / Deep Fried memes, use the included script:
python3 scripts/deep-fry.py meme.png fried.png --level 4 --emojis --flare
Requires: pip install pillow
Template Selection Guide
> For ALL 207 templates with rhetorical patterns and examples, see references/templates-complete.md > For a quick-reference index, see references/template-index.md
Pick templates by rhetorical pattern first, then tone. Each entry includes:
Binary Comparison (reject X / prefer Y)
drake β Drakeposting
pooh β Tuxedo Winnie the Pooh
db β Distracted Boyfriend
glasses β Peter Parker's Glasses
astronaut β Always Has Been
custom template as fallbackSkepticism / Confusion
fry β Futurama Fry (Squinting)
morpheus β Matrix Morpheus
philosoraptor β Philosoraptor
keanu β Conspiracy Keanu
Clever Realization / Big Brain
rollsafe β Roll Safe (Thinking)
gb β Galaxy Brain (Expanding Brain)
scc β Sudden Clarity Clarence
Sarcasm / Mockery
spongebob β Mocking SpongeBob
wonka β Condescending Wonka
kermit β But That's None of My Business
khaby-lame β Khaby Lame Shrug
Panic / Disaster / Pain
fine β This is Fine (Dog in Fire)
harold β Hide the Pain Harold
slap β Will Smith Slapping Chris Rock
gru β Gru's Plan
chair β American Chopper Argument
Wholesome / Positive
success β Success Kid
stonks β Stonks (Meme Man)
handshake β Epic Handshake
Comparison / Identity
same β They're The Same Picture (Corporate)
pigeon β Is This a Pigeon?
spiderman β Spider-Man Pointing
woman-cat β Woman Yelling at Cat
Reaction / Mood
kombucha β Kombucha Girl
right β Anakin PadmΓ© ("Right?")
cmm β Change My Mind
reveal β Scooby Doo Reveal (Unmasking)
Rhetorical Pattern Quick Reference
Use this to identify the right template category before browsing individual templates:
| Pattern | Templates | When to Use | |---------|-----------|-------------| | Binary comparison (A vs B) | Drake, Pooh, Distracted Boyfriend | Rejecting one thing for another | | Escalation (progressively more extreme) | Galaxy Brain, Expanding Brain | Ideas getting increasingly absurd | | Dramatic irony (plan backfires) | Gru's Plan, Anakin/Padme ("Right?") | Confident plan with obvious flaw | | Denial / cope | This Is Fine, Harold | Pretending everything's okay | | Obvious solution ignored | Khaby Lame, Roll Safe | The answer was simple all along | | Mockery / sarcasm | Spongebob, Wonka, Kermit | Making fun of a take | | Identity confusion | Spider-Man Pointing, Same Picture, Pigeon | Things that are the same or misidentified | | Revelation / unmasking | Scooby Doo Reveal, Peter Parker Glasses | Discovering the truth behind something | | Hot take / provocation | Change My Mind | Stating a controversial opinion | | Shared agreement | Epic Handshake | Two sides finding common ground | | Escalating argument | American Chopper | Multi-party conflict |
Trending Templates via Imgflip
When you want the freshest templates (not just built-in IDs):
curl -s "https://api.imgflip.com/get_memes" | python3 -c "
import sys, json
memes = json.load(sys.stdin)['data']['memes'][:20]
for m in memes:
print(f\"{m['name']}: {m['url']}\")
"
Use with custom background:
https://api.memegen.link/images/custom/{top}/{bottom}.png?background={imgflip_url}&width=800
Custom Background URL Encoding
from urllib.parse import quote
bg = quote("https://i.imgflip.com/30b1gx.jpg", safe=":/")
url = f"https://api.memegen.link/images/custom/top/bottom.png?background={bg}&width=800"
For hardcoded fallback templates (when Imgflip is unreachable), see references/templates-classic.md.
For trending template sources (Reddit, Imgflip scraping, Giphy), see references/templates-trending.md.
Local Render with Pillow (fallback, no network)
When memegen.link is down or you need full control:
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO
import textwrap, requestsdef render_meme(image_url, top, bottom="", output="/tmp/meme.png"):
img = Image.open(BytesIO(requests.get(image_url).content)).convert("RGB")
draw = ImageDraw.Draw(img)
w, h = img.size
font_size = max(w // 12, 20)
try:
font = ImageFont.truetype("/usr/share/fonts/truetype/msttcorefonts/Impact.ttf", font_size)
except OSError:
font = ImageFont.load_default()
def draw_block(text, anchor="top"):
if not text: return
text = text.upper()
lines = textwrap.wrap(text, width=max(int((w * 0.9) / (font_size * 0.6)), 10))
line_h = [draw.textbbox((0,0), l, font=font)[3] - draw.textbbox((0,0), l, font=font)[1] for l in lines]
total = sum(line_h) + (len(lines)-1) * 4
y = 10 if anchor == "top" else h - total - 20
for i, line in enumerate(lines):
lw = draw.textbbox((0,0), line, font=font)[2]
draw.text(((w-lw)/2, y), line, font=font, fill="white",
stroke_width=3, stroke_fill="black")
y += line_h[i] + 4
draw_block(top, "top")
draw_block(bottom, "bottom")
img.save(output, quality=95)
return output
Requires: pip install pillow requests and optionally sudo apt install ttf-mscorefonts-installer for Impact font.
β οΈ Known Issues & Lessons
Template names matter β use exact IDs
Common mistakes:buzz-woody β does not exist, grey placeholderbuzz β "X, X Everywhere"disaster-girl β wrongds β Disaster Girlchange-my-mind β wrongcmm β Change My MindWhen unsure, fetch https://api.memegen.link/templates/{id} to verify.
Broken/unreliable built-in templates
These render text-only on grey striped background (no image):simply β "One Does Not Simply" β background doesn't loadalways β "Always Has Been" β background doesn't loadpanik β "Panik Kalm Panik" β 3-panel doesn't renderWorkaround: Use the Imgflip URL from the fallback list with custom template instead.
Don't use formatting tags in meme text
~i~text~i~ β renders literally~n (newline), ~q (?), ~a (&), ~h (#), ~s (/)Text encoding
Tips
?width=800 for larger imagescustom template + ?background=custom as workaroundtime.sleep(0.5) between batch requests β be polite to memegen.linkFor the full template list and special characters reference, see references/api.md.
π Tips & Best Practices
?width=800 for larger imagescustom template + ?background=custom as workaroundtime.sleep(0.5) between batch requests β be polite to memegen.linkFor the full template list and special characters reference, see references/api.md.