Skip to content

ImageEditParameters

MarcoDotIO edited this page Dec 21, 2022 · 2 revisions

ImageEditParameters

Parameter used for creating image edits

public struct ImageEditParameters 

Initializers

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

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

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

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

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

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

Properties

image

The image to edit.

public var image: FormData

Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.

mask

An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where image should be edited.

public var mask: FormData

Must be a valid PNG file, less than 4MB, and have the same dimensions as image.

prompt

A text description of the desired image(s).

public var prompt: String

The maximum length is 1000 characters.

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