Skip to contents

Creates a variation of a given image. See this page for details.

Usage

create_image_variation(
  image,
  n = 1,
  size = c("1024x1024", "256x256", "512x512"),
  response_format = c("url", "b64_json"),
  user = NULL,
  openai_api_key = Sys.getenv("OPENAI_API_KEY"),
  openai_organization = NULL
)

Arguments

image

required; a length one character vector.

n

required; defaults to 1; a length one numeric vector with the integer value greater than 0.

size

required; defaults to "1024x1024"; a length one character vector, one among "256x256", "512x512", and "1024x1024".

response_format

required; defaults to "url"; a length one character vector, one among "url" and "b64_json".

user

optional; defaults to NULL; a length one character vector.

openai_api_key

required; defaults to Sys.getenv("OPENAI_API_KEY") (i.e., the value is retrieved from the .Renviron file); a length one character vector. Specifies OpenAI API key.

openai_organization

optional; defaults to NULL; a length one character vector. Specifies OpenAI organization.

Value

Returns a list, an element of which contain either a link to the image variation or the image variation decoded in Base64.

Details

For arguments description please refer to the official documentation.

See also

Other image functions: create_image_edit(), create_image()

Examples

if (FALSE) { # \dontrun{
image <- system.file("extdata", "astronaut.png", package = "openai")
create_image_variation(
    image = image,
    n = 1,
    size = "256x256",
    response_format = "url"
)
} # }