Skip to main content

Overview

Create variations of an image. DALL-E 2 only. Upload an image to generate variations.

Method Signature

client.images.create_variation(
    image: FileTypes,
    model: Optional[str] = None,
    n: Optional[int] = None,
    response_format: Optional[str] = None,
    size: Optional[str] = None,
    user: Optional[str] = None,
) -> ImagesResponse

Parameters

image
file
required
The image to create variations of. Must be a valid PNG file, less than 4MB, and square.
model
string
The model to use. Currently only openai/dall-e-2 is supported for variations.
n
integer
Number of variations to generate (1-10).
response_format
string
Format for returned images: url or b64_json. URLs are valid for 60 minutes.
size
string
Size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.
user
string
Unique identifier for your end-user, for monitoring and abuse detection.

Response

created
integer
Unix timestamp when the images were created.
data
array
List of image variations.

Example

import dedalus_labs

client = dedalus_labs.Client(api_key="your-api-key")

with open("original.png", "rb") as image_file:
    response = client.images.create_variation(
        image=image_file,
        n=3,
        size="1024x1024"
    )

for i, image in enumerate(response.data):
    print(f"Variation {i+1}: {image.url}")

Build docs developers (and LLMs) love