create_meme: Create meme

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/create_meme.r

Description

Create a meme from a template image

Usage

1
2
3
create_meme(template, upper = NULL, lower = NULL, 
            username = NULL, password = NULL, site = NULL, 
            font = NULL, language = NULL, ...)

Arguments

template

Either an object of class “meme_template” (returned by get_templates) or the URL of an image to caption. If the latter, site is set to “memecaptain”.

upper

The text to display at the top of the meme image.

lower

The text to display at the bottom of the meme image.

username

A username for the relevant meme site. Note: For memegenerator, username and password are passed as plain text, so use at your own risk.

password

A password for the relevant meme site. Note: For memegenerator, username and password are passed as plain text, so use at your own risk.

site

The site used to generate the meme. This is set by default if template is an object of class “meme_template”. One of “imgflip”, “memegenerator”, and “memecaptain”.

font

If site="imgflip", optionally one of “impact” (the default) or “arial”. Otherwise NULL.

language

If site="memegenerator", optionally one of “en” (English), “es” (Spanish), “ru” (Russia), or “–” (other). Otherwise NULL (the default).

...

Additional arguments to curlPerform.

Details

This function creates a meme image from a template image and specified text. If template is an object of class “meme_template”, create_meme automatically determines the site to use for generating the meme. If template is simply an arbitrary image URL (specified as a character string), the meme image is generated using memecaptain. The resulting list of objects are of class “meme”, which has an associated S3 print method that will display the template image as a margin-free JPEG plot in the current graphics device.

To create images with either imgflip or memegenerator, a username and password must be supplied. Important note: For memegenerator, username and password are passed as plain text, so use at your own risk.

Value

An object of class “meme”, which includes a binary representation of the resulting meme image.

Author(s)

Thomas J. Leeper

References

memegenerator API

imgflip API

memecaptain

See Also

get_templates

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
# use imgflip
t1 <- get_templates("imgflip")
m1 <- create_meme(t1[[1]], "Upper text", "Lower text", "username", "password")
plot(m1)

# use memegenerator
t2 <- get_templates("memegenerator")
m2 <- create_meme(t2[[1]], "Upper text", "Lower text", "username", "password")
plot(m2)

# use memecaptain
t3 <- get_templates("memecaptain")
m3 <- create_meme(t3[[1]], "Upper text", "Lower text")
plot(m3)

# use memecaptain with arbitrary image URL
u <- ""
m4 <- create_meme(u, "Upper text", "Lower text")
plot(m4)

## End(Not run)

leeper/meme documentation built on May 21, 2019, 12:37 a.m.