Skip to contents

Generate an image from a prompt and (optionally) information about the talk in which the image will be used.

Usage

gen_image(
  prompt,
  ...,
  api_key = oai_get_default_key(),
  title = NULL,
  description = NULL,
  image_size = c("small", "medium", "large"),
  image_path = NULL,
  call = rlang::caller_env()
)

Arguments

prompt

A description of the image. Must contain 1000 or fewer characters.

...

Additional parameters passed on to the image generation API. We currently use the "dall-e-2" model.

api_key

An OpenAI API key.

title

The title of the talk.

description

(optional) A description of the talk (or any other text you would like to add to the prompt).

image_size

Whether the image should be "small" (256×256 pixels), "medium" (512×512 pixels) or "large" (1024×1024 pixels).

image_path

An optional path where the image should be saved as a png.

call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Value

A magick::image_read()

magick-image object.