Skip to content

ImageVariationParameters

MarcoDotIO edited this page Dec 21, 2022 · 2 revisions

ImageVariationParameters

Parameter struct used for generating image variation(s).

public struct ImageVariationParameters 

Initializers

init(imageData:numberOfImages:resolution:responseFormat:user:)

public init(
        imageData: Data,
        @Clamped(range: 1...10) numberOfImages: Int = 1,
        resolution: ImageResolutions = .large,
        responseFormat: ResponseFormat = .url,
        user: String? = nil
    ) throws 

init(image:numberOfImages:resolution:responseFormat:user:)

os(iOS) || os(tvOS) || os(watchOS)
public init(
        image: UIImage,
        @Clamped(range: 1...10) numberOfImages: Int = 1,
        resolution: ImageResolutions = .large,
        responseFormat: ResponseFormat = .url,
        user: String? = nil
    ) throws 

init(image:numberOfImages:resolution:responseFormat:user:)

os(macOS)
public init(
        image: NSImage,
        @Clamped(range: 1...10) numberOfImages: Int = 1,
        resolution: ImageResolutions = .large,
        responseFormat: ResponseFormat = .url,
        user: String? = nil
    ) throws 

Properties

image

The image to use as the basis for the variation(s).

public var image: FormData

Must be a valid PNG file, less than 4MB, and square.

numberOfImages

The number of images to generate.

public var numberOfImages: Int

Must be between 1 and 10.

resolution

The size of the generated images.

public var resolution: ImageResolutions

Must be one of .small, .medium, or .large.

responseFormat

The format in which the generated images are returned.

public var responseFormat: ResponseFormat

Must be one of url or b64_json.

user

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

public var user: String?

body

The body of the URL used for OpenAI API requests.

public var body: [String: Any] 
Types
Global Functions
Clone this wiki locally