Crate maimai

Crate maimai 

Source
Expand description

Build Status crates.io Documentation License Repository

maimai (['maɪ̯maɪ̯], Zangendeutsch for “meme”) provides a command-line application and a Rust library to generate Memes based on a declarative text format.

This is intended to be an alternative to popular WYSIWYG 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 for Framamèmes and published under the the terms of the CC-0 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 document that can extend other meme definions. This allows implementing the pattern described above.

Source Result
# 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
# examples/reuse.toml

extends = "templates/sophie-no-yes.toml"

[text]
no = "Creating everything from scratch"
yes = "Reusing your work"

§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).

Modules§

partial
Partial meme definition types that are parsed from TOML files and then merged into a Meme.

Structs§

Color
A RGBA color where all values must be in the 0.0..=1.0 range
Error
Any error returned by this library.
Meme
A finalized meme definition.
PartialMeme
A meme definition, usually writting in TOML.
TextBox
A text box that is placed on top of the base layer.
TextOutline
A colored outline that is drawn around the text glyphs.

Enums§

ErrorKind
The kind of error.
HAlign
Horizontal alignment.
IncompleteMemeDefinition
Describes missing information to build a Meme from one or multiple PartialMemes.
MemeBase
The base layer of a meme.
VAlign
Vertical alignment.

Type Aliases§

Result
Any result returned by this library.