pub trait CustomRatioResize {
// Required method
fn resize_custom_ratio(
&self,
width: Option<u32>,
height: Option<u32>,
font_ratio: f64,
filter: FilterType,
) -> DynamicImage;
}Expand description
Trait for resizing images and counting in font ratio
Required Methods§
Sourcefn resize_custom_ratio(
&self,
width: Option<u32>,
height: Option<u32>,
font_ratio: f64,
filter: FilterType,
) -> DynamicImage
fn resize_custom_ratio( &self, width: Option<u32>, height: Option<u32>, font_ratio: f64, filter: FilterType, ) -> DynamicImage
Resize image::DynamicImage to your sizes
When both width and height are None, will return the original image::DynamicImage
§Examples
use image::imageops::FilterType;
use tapciify::{CustomRatioResize, DEFAULT_FONT_RATIO};
let img = image::open("./assets/examples/ferris.webp")?;
let result = img.resize_custom_ratio(Some(64), None, DEFAULT_FONT_RATIO, FilterType::Triangle);