pub struct Image {
pub image: Option<(String, Vec<u8>)>,
pub mask: Option<(String, Vec<u8>)>,
pub prompt: Option<String>,
pub n: Option<u32>,
pub size: Option<Size>,
pub response_format: Option<Format>,
pub user: Option<String>,
pub model: Option<Model>,
}
Expand description
Given a prompt and an instruction, the model will return an edited version of the prompt.
Fields§
§image: Option<(String, Vec<u8>)>
§mask: Option<(String, Vec<u8>)>
§prompt: Option<String>
§n: Option<u32>
§size: Option<Size>
§response_format: Option<Format>
§user: Option<String>
§model: Option<Model>
Implementations§
Source§impl Image
impl Image
Sourcepub fn image(self, filename: &str, bytes: Vec<u8>) -> Self
pub fn image(self, filename: &str, bytes: Vec<u8>) -> Self
The image to edit. 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.
§Arguments
filename
- Image filename to edit or create variantbytes
- Image bytes to edit or create variant
Sourcepub fn model(self, model: Model) -> Self
pub fn model(self, model: Model) -> Self
Select between DALL·E 3 and DALL·E 2, default DALL·E 2 (if not specified).
§Arguments
model
- Model to be used
Sourcepub fn mask(self, filename: &str, bytes: Vec<u8>) -> Self
pub fn mask(self, filename: &str, bytes: Vec<u8>) -> Self
An additional image whose fully transparent areas (e.g. where alpha is
zero) indicate where image
should be edited. Must be a valid PNG
file, less than 4MB, and have the same dimensions as image
.
§Arguments
filename
- Image filename to edit or create variantbytes
- Image bytes to edit or create variant
Sourcepub fn prompt(self, content: &str) -> Self
pub fn prompt(self, content: &str) -> Self
A text description of the desired image(s). The maximum length is 1000 characters.
Sourcepub fn size(self, size: Size) -> Self
pub fn size(self, size: Size) -> Self
The size of the generated images. Must be one of 256x256
, 512x512
,
or 1024x1024
. Use given enum variant.
Sourcepub fn response_format(self, response_format: Format) -> Self
pub fn response_format(self, response_format: Format) -> Self
The format in which the generated images are returned. Must be one of
url
or b64_json
.
Sourcepub fn user(self, user: &str) -> Self
pub fn user(self, user: &str) -> Self
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
Sourcepub async fn editing(&self) -> Result<ImageResponse, Box<dyn Error>>
pub async fn editing(&self) -> Result<ImageResponse, Box<dyn Error>>
Send edit request to OpenAI.
Sourcepub async fn generation(&mut self) -> Result<ImageResponse, Box<dyn Error>>
pub async fn generation(&mut self) -> Result<ImageResponse, Box<dyn Error>>
Send generation request to OpenAI.