| foundry_image | R Documentation |
Generate images using an Azure AI Foundry deployed DALL-E model. Returns a tibble with the generated image URLs or base64-encoded data, along with metadata about the generation.
foundry_image(
prompt,
model = NULL,
n = 1L,
size = "1024x1024",
quality = NULL,
style = NULL,
response_format = NULL,
output_format = NULL,
output_compression = NULL,
background = NULL,
moderation = NULL,
api = c("v1", "deployment"),
api_key = NULL,
token = NULL,
api_version = NULL
)
prompt |
Character. A text description of the desired image(s). |
model |
Character. The deployment name of a DALL-E model.
Defaults to the environment variable |
n |
Integer. Number of images to generate (1-10). Default: 1. |
size |
Character. The size of the generated image(s).
Modern v1 image models support |
quality |
Character. The quality of the image. Modern v1 models support
|
style |
Character. Optional DALL-E 3 style, |
response_format |
Character. Optional DALL-E response format, |
output_format |
Character. Optional v1 image output format, |
output_compression |
Integer. Optional v1 compression level from 0 to
100 for |
background |
Character. Optional v1 background mode: |
moderation |
Character. Optional v1 moderation level: |
api |
Character. API shape to use. |
api_key |
Character. Optional API key override. |
token |
Character. Optional bearer token override. |
api_version |
Character. Optional API version override. |
Model Requirements: The model parameter must be an image-capable
deployment such as a DALL-E or gpt-image-1-series deployment. Chat models
cannot generate images.
Size Availability:
gpt-image-1 series: auto, 1024x1024, 1536x1024, 1024x1536
DALL-E 3: 1024x1024, 1792x1024, 1024x1792
DALL-E 2: 256x256, 512x512, 1024x1024
URL Expiration: Image URLs returned by the API are temporary and will expire.
Use foundry_save_image() to download and save images locally.
A tibble with columns:
Character. The original prompt provided.
Character. DALL-E's interpretation/revision of the prompt (DALL-E 3 only).
Character. URL to the generated image (NA if response_format is "b64_json").
Character. Base64-encoded image data (NA if response_format is "url").
Character. Requested or returned output format.
POSIXct. Timestamp when the image was created.
List. Raw image object returned by the service.
## Not run:
# Requires a configured Azure image endpoint and credentials,
# plus a DALL-E deployment.
# Generate a single image
result <- foundry_image("A sunset over mountains", model = "dall-e-3")
# View the image URL
result$url
# Generate an image with HD quality
result <- foundry_image(
"A futuristic cityscape",
model = "dall-e-3",
quality = "hd",
style = "vivid"
)
# Get base64-encoded images instead of URLs
result <- foundry_image(
"An abstract painting",
model = "dall-e-3",
response_format = "b64_json"
)
# Save an image to disk
result <- foundry_image("A cat wearing a hat", model = "dall-e-3")
local({
path <- tempfile(fileext = ".png")
on.exit(unlink(path))
foundry_save_image(result, path)
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.