Learn R Programming

meme (version 0.1.0)

create_meme: Create meme

Description

Create a meme from a template image

Usage

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.

Value

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

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.

References

memegenerator API

imgflip API

memecaptain

See Also

get_templates

Examples

Run this code
## 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)

Run the code above in your browser using DataLab