Metadata-Version: 2.4
Name: memeplotlib
Version: 0.1.0
Summary: Memes with Python's matplotlib
Project-URL: Homepage, https://github.com/brianckeegan/memeplotlib
Project-URL: Documentation, https://brianckeegan.github.io/memeplotlib/
Project-URL: Repository, https://github.com/brianckeegan/memeplotlib
Project-URL: Issues, https://github.com/brianckeegan/memeplotlib/issues
Author: Brian Keegan
License-Expression: MIT
License-File: LICENSE
Keywords: image-macro,matplotlib,meme,memegen
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Matplotlib
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.10
Requires-Dist: matplotlib>=3.0.0
Requires-Dist: numpy>=1.16.0
Requires-Dist: pillow>=8.0.0
Requires-Dist: platformdirs>=2.0.0
Requires-Dist: requests>=2.20.0
Provides-Extra: dev
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest-mock>=3.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: responses>=0.20.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx-autodoc-typehints>=1.23; extra == 'docs'
Requires-Dist: sphinx>=7.0; extra == 'docs'
Description-Content-Type: text/markdown

# memeplotlib

[![PyPI version](https://img.shields.io/pypi/v/memeplotlib.svg)](https://pypi.org/project/memeplotlib/)
[![conda-forge version](https://img.shields.io/conda/vn/conda-forge/memeplotlib.svg)](https://anaconda.org/conda-forge/memeplotlib)
[![Python versions](https://img.shields.io/pypi/pyversions/memeplotlib.svg)](https://pypi.org/project/memeplotlib/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Memes with Python's matplotlib. Create image macro memes using matplotlib for rendering and the [memegen](https://github.com/jacebrowning/memegen) API for template discovery.

## Installation

**pip:**

```bash
pip install memeplotlib
```

**conda:**

```bash
conda install -c conda-forge memeplotlib
```

## Quick Start

```python
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

```python
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

```python
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:

```python
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

```python
import memeplotlib as memes

memes.config.font = "comic"
memes.config.color = "yellow"
memes.config.style = "none"  # don't auto-uppercase
```

### Template Discovery

```python
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](https://brianckeegan.github.io/memeplotlib/).

To build the docs locally:

```bash
pip install -e ".[docs]"
cd docs
make html
open _build/html/index.html
```

## How It Works

1. Templates are fetched from the [memegen API](https://api.memegen.link) (blank background images + metadata)
2. Images are cached locally for offline reuse
3. Text is rendered using matplotlib's text system with `patheffects.Stroke` for the classic outlined meme look
4. An Impact-like font (Anton) is bundled as a fallback for systems where Impact isn't installed

## Dependencies

- `matplotlib >= 3.0.0`
- `requests`
- `numpy`
- `Pillow`
- `platformdirs`

Requires Python 3.10+.

## License

MIT
