pub struct Image {
pub data: ImageBuffer<Rgba<u8>, Vec<u8>>,
}Expand description
A class to represent an Image object.
This class cannot be constructed from python, rather it is returned from
Generator.render()
Fields§
§data: ImageBuffer<Rgba<u8>, Vec<u8>>The raw RGBA pixel buffer for the rendered image.
Implementations§
Source§impl Image
impl Image
Sourcepub fn save<P>(&self, name: P) -> Result<(), ImgGenRendererError>
pub fn save<P>(&self, name: P) -> Result<(), ImgGenRendererError>
Save the image to a file.
Does not support SVG output.
The file format is inferred from the file extension in the given name.
Sourcepub fn get_bytes(&self) -> Result<Cow<'_, [u8]>, ImgGenRendererError>
pub fn get_bytes(&self) -> Result<Cow<'_, [u8]>, ImgGenRendererError>
Get a byte array of the image data.
Sourcepub fn get_sha256(&self) -> Result<String, ImgGenRendererError>
pub fn get_sha256(&self) -> Result<String, ImgGenRendererError>
Get the SHA256 hash of the image data as a hex string.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Image
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnsafeUnpin for Image
impl UnwindSafe for Image
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more