# maimai
[][__link0]
[][__link1]
[][__link2]
[][__link3]
[][__link4]
*maimai* (\['maɪ̯maɪ̯\], Zangendeutsch for “meme”) provides a command-line
application and a Rust library to generate [Memes][__link5] based on a declarative
text format.
This is intended to be an alternative to popular [WYSIWYG][__link6] meme editors,
that don’t give you much control and often have problems creating
reproducable, high quality content.

***All image templates used in this project were hand-drawn by [Gee][__link7] for
[Framamèmes][__link8] and published under the the terms of the [CC-0][__link9] License.***
## Usage
In many cases, a meme is created from 3 “layers”:
* the base image (often taken from a popular TV show or from stock images)
* the text layout that defines, where text is placed on the base image and
how it is formatted
* the text content
The first two “layer” are usually shared between different memes and the
text content is replaced for a different joke.
A `maimai` meme definition is written as a [TOML][__link10] document that can extend
other meme definions. This allows implementing the pattern described
above.
<table>
<tr>
<th>Source</th>
<th>Result</th>
</tr>
<tr>
<td>
```toml
# examples/templates/sophie-no-yes.toml
image = "sophie-no-yes.png"
[text.no]
text = "Bad text"
position = [420, 20]
size = [360, 360]
color = "black"
font-size = 60
[text.yes]
text = "Good text"
position = [420, 420]
size = [360, 360]
color = "black"
font-size = 60
```
</td>
<td>
<img src="https://codeberg.org/d-k-bo/maimai/media/branch/main/examples/templates/sophie-no-yes.webp" height="400"/>
</td>
</tr>
<tr>
<td>
```toml
# examples/reuse.toml
extends = "templates/sophie-no-yes.toml"
[text]
no = "Creating everything from scratch"
yes = "Reusing your work"
```
</td>
<td>
<img src="https://codeberg.org/d-k-bo/maimai/media/branch/main/examples/reuse.webp" height="400"/>
</td>
</tr>
</table>
## License
This project is licensed under the GNU Affero General Public License version 3 or (at your option) any later version (AGPL-3.0-or-later).
[__link0]: https://codeberg.org/d-k-bo/maimai/actions?workflow=rust.yml
[__link1]: https://lib.rs/crates/maimai
[__link10]: https://toml.io/
[__link2]: https://docs.rs/maimai
[__link3]: https://codeberg.org/d-k-bo/maimai/src/branch/main/COPYING
[__link4]: https://codeberg.org/d-k-bo/maimai/
[__link5]: https://en.wikipedia.org/wiki/Internet_meme
[__link6]: https://en.wikipedia.org/wiki/WYSIWYG
[__link7]: https://ptilouk.net/
[__link8]: https://framamemes.org/
[__link9]: https://creativecommons.org/publicdomain/zero/1.0/