Created in T3 Code.
npm install
npm run fetch:imgflip # scrape all pages of imgflip.com/memetemplates → data/raw/imgflip/
npm run dedupe # remove duplicates → data/templates/ (+ index.json)
npm run extract:characters # cut characters out of templates → data/characters/ (+ index.json)fetch:imgflipdownloads the full-size original of every template (falling back to.png/.gifwhen the.jpgdoesn't exist). Animated ("GIF") templates are downloaded as the.mp4imgflip serves them as. It's resumable: already-downloaded files are skipped, and templates that have dropped out of imgflip's listing since the last run are kept.dedupetrims uniform borders, then groups images that are the same picture (perceptual dHash + colour thumbnail + aspect ratio) or a crop of one another (normalized cross-correlation, then the same checks on the aligned region). It keeps the most popular name and the highest-resolution file, records the other names asaliases, and writes a.poster.jpgstill for animated templates. Review merged groups indata/duplicates.html. The other members' files are kept too, as the template'sduplicates. An animated and a static image are never duplicates: they're split into two templates that are each other'svariants.- Related templates that aren't duplicates become each other's
variants: one is animated and the other not, one is some of the other's panels (3 vs 4 panels), their pictures share a layout but differ (recoloured…), or one name's words are all in the other's ("Three-headed Dragon" / "4 headed dragon"). They're listed indata/duplicates.htmltoo. - Duplicates the comparison misses (swapped panels, collages…) go under
sameinscripts/duplicates.json, and false matches underdifferent, by imgflip id. Likewise, missed variants go undervariantsand false ones underunrelated. Other names a template is known by go underaliases, with thenamesto add.npm run dedupe -- --explain <id>,<id>shows why two images match or not. - Frames are read from videos with the ffmpeg binary from
ffmpeg-static(setFFMPEGto use another one). extract:characterscuts the character out of the templates listed inscripts/characters.json(a subject over sunburst slices or another flat or geometric background, a plain white one, line art…) and saves it as a transparent PNG, cropped to it, indata/characters/. Each entry ofdata/characters/index.jsonhas the character'sid,name,file, size and thetemplateit comes from. Review them indata/characters.html. The background is flood-filled from the image's edges (scripts/cutout.ts), so when a cut-out is off, tune its entry:edgesthe subject is cut off by,tolerance,driftfor gradient backgrounds,holes: falsewhen the subject shares the background's colours,linesfor the seams between slices,erase/keeprectangles,seedsfor background the edges don't reach (behind a frame)… For line art on white,closecloses gaps in the outlines so the fill doesn't leak inside, andminSeedkeeps it from starting on lines that run into the edges. A template with several characters gets an entry for each, with its ownid,nameand thecropof the template it's in. Transparent templates are cut out like the others (over magenta).npm run extract:characters -- --only <template id>redoes some of them.
npm start # builds the client, then http://127.0.0.1:4321 (override with PORT / HOST)A dependency-free Node server (server/) serving the page in public/ (index.html
and style.css) and its script, compiled from client/ to dist/client/, to search,
sort and view the templates in data/templates/, and to make memes of them. The viewer's alternatives panel
(button or A) lists the template's other formats (its duplicates, which a
switch can hide) and its variations. Thumbnails are rendered on demand
with sharp and cached in data/thumbs/.
The category menu filters the list: GIFs (animated templates), Complete (every
other template), Backgrounds (blank pages, plain colours), Formats (empty panel
layouts, the demotivational poster), Characters (the transparent cut-outs from data/characters/,
linked to their template as variants) and Diagrams (see below). Backgrounds and
Formats are listed by template id in client/categories.ts.
? (or the “?” button) lists them all. On the page and in the viewer, S or
/ searches, G then a letter goes to a category (All,
GIFs, complete Templates, Backgrounds, Characters,
Diagrams, Formats), N creates a background, I a meme from an image, and . goes
back to the top. The arrow keys select a template in the grid, O (or Enter)
opens it and E edits it. In the viewer, the arrow keys go to the previous or next
template, A shows the alternatives, E edits, O opens the original
and D downloads it. In the editors, D downloads the picture; in the meme
editor, S searches the characters (the templates to fill a selected panel with) and Ctrl+C copies the meme when
no text is selected. Letters are typed, not shortcuts, in a field or on a text of the meme. They're listed in
client/shortcuts.ts, and handled in client/main.ts.
“Edit” in the viewer (or E, or #edit/<template id> in the address bar) opens the
template on show in an editor, drawn on a canvas in the browser. It starts with a text at
the top and one at the bottom: type, and download.
- Texts: each has a field in the panel and a box on the picture. Drag the box to move it (it snaps to the middle of the picture, unless Alt is held), its corners to resize it and the handle above it to rotate it; the arrow keys nudge it, resize it with Alt, and Delete removes it. A text wraps in its box, and shrinks to fit it. Typing on a box, or double-clicking it, goes to its field.
- Text style: “Classic” (white Impact capitals with a black outline), “Plain” (black Arial) or “Label” (bold white with an outline), or its own font, size, colours, outline, alignment, capitals and rotation. “Apply style to all” gives it to every text.
- “Add caption above” adds white space over the picture with a plain text in it, the way memes are captioned nowadays. “Space around” sets that space on each side, and its colour.
- Images go on top, under the texts: a character from the Characters category, or uploaded, dropped or pasted ones. They’re moved, resized and rotated like the texts, and can be flipped.
- Panels: the Formats made of panels (the blank comic panels, the starter pack, “What my
friends think I do” and bingo) start with texts where the format has them (a text at the top of
each comic panel, a title, the labels under the panels…), and each panel can be filled with a
Complete template or an uploaded picture: click a panel, on the picture or in the list, then
pick one (an image dropped on a panel fills it too). The picture covers the panel, cropped:
drag it, or the handle in the middle of the selected panel (over any text), to move it, and zoom with the wheel, the slider or + and -; “Fit”
shows it whole. A new text or image goes in the selected panel, and layers snap to the
panels’ middles as well as the picture’s. The panels of each format are in
client/formats.ts, measured on the template’s own file (a duplicate’s file isn’t laid out). - Undo and redo (Ctrl+Z, Ctrl+Shift+Z), “Copy” to the clipboard and “Download PNG”, at the picture’s own size or at a width.
- The meme is kept in the URL hash, so it can be bookmarked or shared (uploaded images stay
local), and comes back when the template is edited again. The viewer’s alternatives are
edited too:
fin the hash is the duplicate’s file. Of an animated template, it’s the still that is edited: “Edit GIF on imgflip” captions the animation itself, in imgflip’s GIF maker. - “Add text…” in the background editor makes a meme of the background made there.
- Create → “From an image…” in the header (or I) makes a meme of an image of your own, like a template; so does dropping one on the list, or pasting one (outside the search field). It stays local: it isn’t kept in the URL hash.
Impact is rarely installed outside Windows and macOS, so the page falls back on
Anton, which looks like it, served from the
@fontsource/anton package (SIL Open Font License).
The model, its URL encoding, the fitting of texts, the geometry of layers and panels and the drawing
are in client/meme.ts (DOM-free, tested), and the dialog in client/meme-editor.ts.
The Diagrams category holds funny takes on the sample diagrams of the Mermaid live editor, one per diagram type (a flowchart deciding whether to deploy on Friday, a sequence diagram of a code review, a Venn diagram of fast, cheap and good…). Each tile is named after its diagram type, and shows the diagram as rendered by mermaid.ink; the example's name is its alias. It opens in the viewer like a template, with its formats as alternatives: a look (hand-drawn, neo) or a theme (dark, forest, neutral), set in Mermaid's config. “Open original” opens the SVG, “Download” saves a PNG, and “Edit in mermaid.live” opens the diagram, in the format on show, in the editor. The diagram and its config travel in the links themselves, so it works without any template. mermaid.ink turns away bursts of requests, so the page asks for three pictures at a time, and tries again when turned away.
The examples and formats are in client/diagrams.ts. Each was checked against
Mermaid 12's parser and renderer, in every format: do the same for a new one by
pasting it in the editor.
Create → “Blank background” in the header (or N, the “Create your own” tile heading the Backgrounds, or #editor
in the address bar) opens an editor for backgrounds
in the style of advice-animal templates, drawn on a canvas in the browser:
- Patterns: sunburst (slices from a centre point, colours in turn), glow (a radial gradient through its colours, with optional light rays), split (two halves, top/bottom or left/right, each with its own sunburst colours) and solid.
- Settings: up to 8 colours, slice count, rotation, uneven slice widths (seeded, with “Shuffle widths”), the centre (drag it on the preview or use the arrow keys), lines between slices, shading across each slice, darkened corners and the output size.
- “Start from a template’s look…” applies the look of a well-known template (Annoying Facebook Girl, Courage Wolf, Socially Awesome Awkward Penguin…).
- An image goes on top: a character from the Characters category, or an uploaded, dropped or pasted one (a PNG with a transparent background works best). Drag it to move it, and set its size and a white halo.
- “Download PNG” saves the result, and “Add text…” opens it in the meme editor. The design is kept in the URL hash, so it can be bookmarked or shared (an uploaded image stays local).
The model, its URL encoding, the presets and the drawing are in client/background.ts
(DOM-free, tested), and the dialog in client/editor.ts.
Everything is TypeScript. Node ≥ 26 runs the server and scripts
directly by stripping types, so only the browser code in client/ is compiled
(npm run build).
npm run lint # ESLint (npm run lint:fix to fix)
npm run format:check # Prettier (npm run format to fix)
npm run typecheck # tsc, for Node and browser code
npm test # node --test on every *.test.tsCI (.github/workflows/ci.yml) runs all four on every push to main and every pull request.
The code is under the MIT License. It doesn't cover the meme templates or the characters cut out of them, which belong to their respective owners (see the terms of use), nor the Anton font, which is under the SIL Open Font License.