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 set_color_transform(&mut self, transform: ColorTransform)
pub fn set_color_transform(&mut self, transform: ColorTransform)
Colour transform to use when decoding the image. App segments relating to colour transforms will be ignored.
sourcepub fn set_max_decoding_buffer_size(&mut self, max: usize)
pub fn set_max_decoding_buffer_size(&mut self, max: usize)
Set maximum buffer size allowed for decoded images
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 exif_data(&self) -> Option<&[u8]>
pub fn exif_data(&self) -> Option<&[u8]>
Returns raw exif data, starting at the TIFF header, if the image contains any.
The returned value will be None
until a call to decode
has returned Ok
.
sourcepub fn xmp_data(&self) -> Option<&[u8]>
pub fn xmp_data(&self) -> Option<&[u8]>
Returns the raw XMP packet if there is any.
The returned value will be None
until a call to 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.