Struct RustImageData

Source
pub struct RustImageData { /* private fields */ }

Trait Implementations§

Source§

impl RustImage for RustImageData

Source§

fn empty() -> Self

create an empty image
Source§

fn is_empty(&self) -> bool

Source§

fn from_path(path: &str) -> Result<Self>

Read image from file path
Source§

fn from_bytes(bytes: &[u8]) -> Result<Self>

Create a new image from a byte slice
Source§

fn from_dynamic_image(image: DynamicImage) -> Self

Source§

fn get_size(&self) -> (u32, u32)

width and height
Source§

fn thumbnail(&self, width: u32, height: u32) -> Result<Self>

Scale this image down to fit within a specific size. Returns a new image. The image’s aspect ratio is preserved. The image is scaled to the maximum possible size that fits within the bounds specified by nwidth and nheight. Read more
Source§

fn resize(&self, width: u32, height: u32, filter: FilterType) -> Result<Self>

en: Adjust the size of the image without retaining the aspect ratio zh: 调整图片大小,不保留长宽比
Source§

fn save_to_path(&self, path: &str) -> Result<()>

Source§

fn get_dynamic_image(&self) -> Result<DynamicImage>

Source§

fn to_rgba8(&self) -> Result<RgbaImage>

Source§

fn encode_image( &self, target_color_type: ColorType, format: ImageFormat, ) -> Result<RustImageBuffer>

Source§

fn to_jpeg(&self) -> Result<RustImageBuffer>

Source§

fn to_png(&self) -> Result<RustImageBuffer>

en: Convert to png format, the returned image is a new image, and the data itself will not be modified zh: 转为 png 格式,返回的为新的图片,本身数据不会修改

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.