pub struct TransformOptions<'a> {
pub width: Option<u64>,
pub height: Option<u64>,
pub resize: Option<&'a str>,
pub format: Option<&'a str>,
pub quality: Option<u8>,
}
Expand description
Options for image transformation operations
Provides configuration for resizing, reformatting, and quality adjustments of images
§Example
let options = TransformOptions {
width: Some(800),
height: Some(600),
resize: Some("cover"),
format: Some("webp"),
quality: Some(80),
};
Fields§
§width: Option<u64>
The width of the image in pixels
height: Option<u64>
The height of the image in pixels
resize: Option<&'a str>
The resize mode can be cover, contain or fill. Defaults to cover. Cover resizes the image to maintain it’s aspect ratio while filling the entire width and height. Contain resizes the image to maintain it’s aspect ratio while fitting the entire image within the width and height. Fill resizes the image to fill the entire width and height. If the object’s aspect ratio does not match the width and height, the image will be stretched to fit.
format: Option<&'a str>
Specify the format of the image requested.
When using ‘origin’ we force the format to be the same as the original image. When this option is not passed in, images are optimized to modern image formats like Webp.
quality: Option<u8>
Sets the quality of the returned image
A number from 20 to 100, with 100 being the highest quality. Defaults to 80
Trait Implementations§
Source§impl<'a> Clone for TransformOptions<'a>
impl<'a> Clone for TransformOptions<'a>
Source§fn clone(&self) -> TransformOptions<'a>
fn clone(&self) -> TransformOptions<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more