haomeme_batch_generate
Generate up to 50 HaoMeme-style meme PNGs in one call by reusing a single browser session, so you can batch-render multiple captioned images without repeating setup.
Instructions
Generate 1..50 HaoMeme-style meme PNGs in ONE call, reusing a single headless-browser page — much faster than one haomeme_generate call per image (the browser and fonts load once). items = an array of spec objects, EACH accepting the same optional fields as haomeme_generate (full reference: FIELD_HELP below, or call haomeme_catalog once first for the live portrait keys). RULES THAT MATTER: (1) line breaks are written as the two characters backslash-n inside the JSON argument, e.g. "第一行\n第二行" — a literal newline can be dropped and your two captions will end up on one line; (2) lineColors is ONE colour per line (white|yellow|red), default white then yellow; (3) template teaches/crash put the portrait on the LEFT, nope puts it on the RIGHT. Example: [{"text":"第一行\n第二行","lineColors":["white","yellow"],"template":"teach","portrait":"A","backdrop":"red"},{"text":"A\nB","template":"nope","portrait":"I","backdrop":"dark"}]. A single bad item does NOT fail the batch: it returns {ok:false, index, error} and the rest still render. Returns {ok, count, succeeded, outputDir, results[]} where each result is {ok, path, bytes, width, height, template, text}. The first call may take ~20-60s while the browser starts; afterwards each item is fast. outputDir must stay inside the project folder (default ./output; override with HAOMEME_OUTPUT_ROOT).
FIELD REFERENCE (all optional, omitted = template default): HaoMeme spec fields — EVERY field is optional; an omitted field keeps that template's own default: text string, max 300 chars. The headline. To break a line write the two characters backslash-n ("\n") INSIDE the JSON argument, e.g. "第一行\n第二行". Do NOT rely on a literal line-break character in the JSON string: some clients drop it and the two captions collapse onto one line (and the filename loses the break too). Omit text to use the template preset listed below. template teach | crash | nope | sue (default: teach) lineColors array, max 8, ONE colour per line: white | yellow | red. Line 1 defaults to white, line 2 to yellow, any extra line to white. The colour is per LINE, not per character. portrait built-in portrait key (single letter, from haomeme_catalog's live list). Overrides portraitIndex. portraitIndex zero-based index into that portrait list (alternative to portrait). backdrop red | classroom | oldClassroom | room | grey | dark | smoke red = flat red with the paint stroke; the others are photo sets. side left | right — which side the portrait sits on. textSize 30..220 (100 = default, bigger = larger type) rotation -180..180 degrees of text rotation brushSize 30..250 (100 = default) — red paint-stroke thickness portraitSize 30..260 (100 = default) backgroundSize 10..300 (100 = default) backgroundBlur 0..30 px — blur on photo backdrops redBrush boolean — show the red paint stroke under the text brushInFront boolean — paint stroke in front of the portrait (still below the text) italic boolean — lean the text to the right flip boolean — mirror the portrait
LAYOUT (verified by actually rendering): teach and crash = portrait on the LEFT with the big headline on the right; nope = portrait on the RIGHT with the text on the left; sue = the lawyer-letter style. Use nope when you want the portrait and the text on opposite sides from teach/crash.
Preset text used when "text" is omitted: teach 輪到你\n教育我了? crash AI教育\n翻車了? nope 想玩GTA6?\n免談 sue 你準備收\n律師傳票
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"items": "<items>"
},
"name": "haomeme_batch_generate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | 1-50 meme specs (one object per meme). Each spec accepts the same optional fields as haomeme_generate — see the field reference above or in haomeme_catalog. | |
| outputDir | No | Folder inside this project; defaults to ./output. Paths outside the project root are rejected (set HAOMEME_OUTPUT_ROOT to change the root). |