Memes with Python's matplotlib
Project description
memeplotlib
Memes with Python's matplotlib. Create image macro memes using matplotlib for rendering and the memegen API for template discovery.
Installation
pip:
pip install memeplotlib
conda:
conda install -c conda-forge memeplotlib
Quick Start
import memeplotlib as memes
# One-liner meme from a memegen template
memes.meme("buzz", "memes", "memes everywhere")
# Save to file
memes.meme("doge", "such code", "very bug", savefig="meme.png", show=False)
Features
Functional API
import memeplotlib as memes
# Customize text styling
memes.meme("drake", "writing tests", "shipping to prod",
font="impact", color="yellow")
# Get figure/axes back for further customization
fig, ax = memes.meme("distracted", "my project", "new framework", "me",
show=False)
# Use a local image as template
memes.meme("/path/to/image.jpg", "top text", "bottom text")
Object-Oriented API
from memeplotlib import Meme
# Step by step
m = Meme("buzz")
m.top("memes")
m.bottom("memes everywhere")
m.save("output.png")
# Or chained
Meme("doge").top("such code").bottom("very bug").show()
Memify Existing Plots
Turn any matplotlib figure into a meme:
import matplotlib.pyplot as plt
import memeplotlib as memes
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 4, 9])
memes.memify(fig, "stonks")
Global Configuration
import memeplotlib as memes
memes.config.font = "comic"
memes.config.color = "yellow"
memes.config.style = "none" # don't auto-uppercase
Template Discovery
from memeplotlib import TemplateRegistry
reg = TemplateRegistry()
results = reg.search("dog")
all_templates = reg.list_all()
Documentation
Full documentation including a tutorial, user guide, and API reference is available at brianckeegan.github.io/memeplotlib.
To build the docs locally:
pip install -e ".[docs]"
cd docs
make html
open _build/html/index.html
How It Works
- Templates are fetched from the memegen API (blank background images + metadata)
- Images are cached locally for offline reuse
- Text is rendered using matplotlib's text system with
patheffects.Strokefor the classic outlined meme look - An Impact-like font (Anton) is bundled as a fallback for systems where Impact isn't installed
Dependencies
matplotlib >= 3.0.0requestsnumpyPillowplatformdirs
Requires Python 3.10+.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file memeplotlib-0.1.0.tar.gz.
File metadata
- Download URL: memeplotlib-0.1.0.tar.gz
- Upload date:
- Size: 110.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
273550e4c6222a3b7532de6e82f7421c61d650c70af4334f4abe9a0ee294531d
|
|
| MD5 |
bce3d4d89beadacac618ec4ad35d747c
|
|
| BLAKE2b-256 |
3865fc1b1a38bc513a558430df4a824ac4683696d91855aaac21d9e4b9478974
|
Provenance
The following attestation bundles were made for memeplotlib-0.1.0.tar.gz:
Publisher:
publish_pypi.yml on brianckeegan/memeplotlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memeplotlib-0.1.0.tar.gz -
Subject digest:
273550e4c6222a3b7532de6e82f7421c61d650c70af4334f4abe9a0ee294531d - Sigstore transparency entry: 945856137
- Sigstore integration time:
-
Permalink:
brianckeegan/memeplotlib@f5df9dbd45d2dbda6d3d63d52176d511152f8fb2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/brianckeegan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@f5df9dbd45d2dbda6d3d63d52176d511152f8fb2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file memeplotlib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: memeplotlib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 101.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c538ed43993b7d5fc920726b710df21b6477ffecc81be2ce31cdf238705068b
|
|
| MD5 |
1f1301b5a03223f948560abe5975eb10
|
|
| BLAKE2b-256 |
e4383861f697e529f620edeecce99fb63446eaaf98a3aa1caa3ea9fe84cc3ea5
|
Provenance
The following attestation bundles were made for memeplotlib-0.1.0-py3-none-any.whl:
Publisher:
publish_pypi.yml on brianckeegan/memeplotlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memeplotlib-0.1.0-py3-none-any.whl -
Subject digest:
6c538ed43993b7d5fc920726b710df21b6477ffecc81be2ce31cdf238705068b - Sigstore transparency entry: 945856167
- Sigstore integration time:
-
Permalink:
brianckeegan/memeplotlib@f5df9dbd45d2dbda6d3d63d52176d511152f8fb2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/brianckeegan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@f5df9dbd45d2dbda6d3d63d52176d511152f8fb2 -
Trigger Event:
workflow_dispatch
-
Statement type: