Struct jpeg_decoder::Decoder
source · pub struct Decoder<R> { /* private fields */ }
Expand description
JPEG decoder
Implementations§
source§impl<R: Read> Decoder<R>
impl<R: Read> Decoder<R>
sourcepub fn info(&self) -> Option<ImageInfo>
pub fn info(&self) -> Option<ImageInfo>
Returns metadata about the image.
The returned value will be None
until a call to either read_info
or decode
has
returned Ok
.
sourcepub fn icc_profile(&self) -> Option<Vec<u8>>
pub fn icc_profile(&self) -> Option<Vec<u8>>
Returns the embeded icc profile if the image contains one.
sourcepub fn read_info(&mut self) -> Result<(), Error>
pub fn read_info(&mut self) -> Result<(), Error>
Tries to read metadata from the image without decoding it.
If successful, the metadata can be obtained using the info
method.
sourcepub fn scale(
&mut self,
requested_width: u16,
requested_height: u16,
) -> Result<(u16, u16), Error>
pub fn scale( &mut self, requested_width: u16, requested_height: u16, ) -> Result<(u16, u16), Error>
Configure the decoder to scale the image during decoding.
This efficiently scales the image by the smallest supported scale factor that produces an image larger than or equal to the requested size in at least one axis. The currently implemented scale factors are 1/8, 1/4, 1/2 and 1.
To generate a thumbnail of an exact size, pass the desired size and then scale to the final size using a traditional resampling algorithm.
Auto Trait Implementations§
impl<R> Freeze for Decoder<R>where
R: Freeze,
impl<R> RefUnwindSafe for Decoder<R>where
R: RefUnwindSafe,
impl<R> Send for Decoder<R>where
R: Send,
impl<R> Sync for Decoder<R>where
R: Sync,
impl<R> Unpin for Decoder<R>where
R: Unpin,
impl<R> UnwindSafe for Decoder<R>where
R: UnwindSafe,
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> 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