pub struct EditImageParametersBuilder { /* private fields */ }Expand description
Builder for EditImageParameters.
Implementations§
Source§impl EditImageParametersBuilder
impl EditImageParametersBuilder
Sourcepub fn image<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn image<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
要编辑的图像。可以是base64编码的图像数据或者URL。
Sourcepub fn background<VALUE: Into<BackgroundStyle>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn background<VALUE: Into<BackgroundStyle>>( &mut self, value: VALUE, ) -> &mut Self
允许为生成的图像设置背景透明度。此参数仅支持gpt-image-1。 必须是transparent、opaque或auto(默认值)之一。当使用auto时,模型将自动确定图像的最佳背景。 如果设置为transparent,输出格式需要支持透明度,因此应设置为png(默认值)或webp。
Sourcepub fn input_fidelity<VALUE: Into<InputFidelity>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn input_fidelity<VALUE: Into<InputFidelity>>( &mut self, value: VALUE, ) -> &mut Self
控制模型在匹配输入图像的风格和特征(尤其是面部特征)上付出的努力程度。 此参数仅支持gpt-image-1。不支持gpt-image-1-mini。支持high和low。默认为low。
Sourcepub fn mask<VALUE: Into<FileUpload>>(&mut self, value: VALUE) -> &mut Self
pub fn mask<VALUE: Into<FileUpload>>(&mut self, value: VALUE) -> &mut Self
另一个图像,其完全透明区域(例如alpha为零的地方)指示应该编辑图像的位置。 如果提供了多个图像,则遮罩将应用于第一个图像。 必须是有效的PNG文件,小于4MB,并且具有与图像相同的尺寸。
Sourcepub fn mime_type<VALUE: Into<MimeType>>(&mut self, value: VALUE) -> &mut Self
pub fn mime_type<VALUE: Into<MimeType>>(&mut self, value: VALUE) -> &mut Self
图像的mime类型。如果未提供,mime类型将被设置为application/octet-stream。
gpt-image-1期望image/png、image/jpeg或image/webp。
Sourcepub fn output_compression<VALUE: Into<u32>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn output_compression<VALUE: Into<u32>>( &mut self, value: VALUE, ) -> &mut Self
生成图像的压缩级别(0-100%)。此参数仅支持gpt-image-1与webp或jpeg输出格式,并默认为100。
Sourcepub fn output_format<VALUE: Into<OutputFormat>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn output_format<VALUE: Into<OutputFormat>>( &mut self, value: VALUE, ) -> &mut Self
返回生成图像的格式。此参数仅支持gpt-image-1。必须是png、jpeg或webp之一。默认值是png。
Sourcepub fn partial_images<VALUE: Into<u32>>(&mut self, value: VALUE) -> &mut Self
pub fn partial_images<VALUE: Into<u32>>(&mut self, value: VALUE) -> &mut Self
要生成的部分图像数量。此参数用于返回部分图像的流式响应。 值必须在0到3之间。设置为0时,响应将是单个图像在一个流事件中发送。 注意,如果完整图像生成得更快,则最终图像可能会在生成完全部分图像之前发送。
Sourcepub fn quality<VALUE: Into<ImageQuality>>(&mut self, value: VALUE) -> &mut Self
pub fn quality<VALUE: Into<ImageQuality>>(&mut self, value: VALUE) -> &mut Self
将生成的图像质量。hd创建具有更精细细节和更大一致性的图像。 gpt-image-1支持high、medium和low。dall-e-2仅支持standard质量。
Sourcepub fn response_format<VALUE: Into<ResponseFormat>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn response_format<VALUE: Into<ResponseFormat>>( &mut self, value: VALUE, ) -> &mut Self
返回生成图像的格式。必须是url或b64_json之一。URL在图像生成后仅在60分钟内有效。此参数仅支持dall-e-2,因为gpt-image-1将始终返回base64编码的图像。
Sourcepub fn size<VALUE: Into<ImageSize>>(&mut self, value: VALUE) -> &mut Self
pub fn size<VALUE: Into<ImageSize>>(&mut self, value: VALUE) -> &mut Self
生成图像的尺寸。对于gpt-image-1必须是1024x1024、1536x1024(横向)、1024x1536(纵向)或auto(默认值), 对于dall-e-2是256x256、512x512或1024x1024之一,对于dall-e-3是1024x1024、1792x1024或1024x1792之一。
Sourcepub fn stream<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn stream<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
在流模式下编辑图像。默认为false。请参阅图像生成指南以获取更多信息。
Sourcepub fn user<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn user<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
表示您的最终用户的唯一标识符,可以帮助OpenAI监控和检测滥用行为。
Sourcepub fn build(
&self,
) -> Result<EditImageParameters, EditImageParametersBuilderError>
pub fn build( &self, ) -> Result<EditImageParameters, EditImageParametersBuilderError>
Trait Implementations§
Source§impl Clone for EditImageParametersBuilder
impl Clone for EditImageParametersBuilder
Source§fn clone(&self) -> EditImageParametersBuilder
fn clone(&self) -> EditImageParametersBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more