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>,
}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>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 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.