Skip to main content

EditImageParameters

Struct EditImageParameters 

Source
pub struct EditImageParameters {
Show 16 fields pub image: String, pub prompt: Option<String>, pub background: Option<BackgroundStyle>, pub input_fidelity: Option<InputFidelity>, pub mask: Option<FileUpload>, pub mime_type: Option<MimeType>, pub model: Option<String>, pub n: Option<u32>, pub output_compression: Option<u32>, pub output_format: Option<OutputFormat>, pub partial_images: Option<u32>, pub quality: Option<ImageQuality>, pub response_format: Option<ResponseFormat>, pub size: Option<ImageSize>, pub stream: Option<bool>, pub user: Option<String>,
}

Fields§

§image: String

要编辑的图像。可以是base64编码的图像数据或者URL。

§prompt: Option<String>

提示词。

§background: Option<BackgroundStyle>

允许为生成的图像设置背景透明度。此参数仅支持gpt-image-1。 必须是transparent、opaque或auto(默认值)之一。当使用auto时,模型将自动确定图像的最佳背景。 如果设置为transparent,输出格式需要支持透明度,因此应设置为png(默认值)或webp。

§input_fidelity: Option<InputFidelity>

控制模型在匹配输入图像的风格和特征(尤其是面部特征)上付出的努力程度。 此参数仅支持gpt-image-1。不支持gpt-image-1-mini。支持high和low。默认为low。

§mask: Option<FileUpload>

另一个图像,其完全透明区域(例如alpha为零的地方)指示应该编辑图像的位置。 如果提供了多个图像,则遮罩将应用于第一个图像。 必须是有效的PNG文件,小于4MB,并且具有与图像相同的尺寸。

§mime_type: Option<MimeType>

图像的mime类型。如果未提供,mime类型将被设置为application/octet-stream。 gpt-image-1期望image/pngimage/jpegimage/webp

§model: Option<String>

用于图像生成的模型。

§n: Option<u32>

要生成的图像数量。必须介于1到10之间。

§output_compression: Option<u32>

生成图像的压缩级别(0-100%)。此参数仅支持gpt-image-1与webp或jpeg输出格式,并默认为100。

§output_format: Option<OutputFormat>

返回生成图像的格式。此参数仅支持gpt-image-1。必须是png、jpeg或webp之一。默认值是png。

§partial_images: Option<u32>

要生成的部分图像数量。此参数用于返回部分图像的流式响应。 值必须在0到3之间。设置为0时,响应将是单个图像在一个流事件中发送。 注意,如果完整图像生成得更快,则最终图像可能会在生成完全部分图像之前发送。

§quality: Option<ImageQuality>

将生成的图像质量。hd创建具有更精细细节和更大一致性的图像。 gpt-image-1支持high、medium和low。dall-e-2仅支持standard质量。

§response_format: Option<ResponseFormat>

返回生成图像的格式。必须是url或b64_json之一。URL在图像生成后仅在60分钟内有效。此参数仅支持dall-e-2,因为gpt-image-1将始终返回base64编码的图像。

§size: Option<ImageSize>

生成图像的尺寸。对于gpt-image-1必须是1024x1024、1536x1024(横向)、1024x1536(纵向)或auto(默认值), 对于dall-e-2是256x256、512x512或1024x1024之一,对于dall-e-3是1024x1024、1792x1024或1024x1792之一。

§stream: Option<bool>

在流模式下编辑图像。默认为false。请参阅图像生成指南以获取更多信息。

§user: Option<String>

表示您的最终用户的唯一标识符,可以帮助OpenAI监控和检测滥用行为。

Trait Implementations§

Source§

impl Clone for EditImageParameters

Source§

fn clone(&self) -> EditImageParameters

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EditImageParameters

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EditImageParameters

Source§

fn default() -> EditImageParameters

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for EditImageParameters

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for EditImageParameters

Source§

fn eq(&self, other: &EditImageParameters) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for EditImageParameters

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for EditImageParameters

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,