pub struct Decompress<R> { /* private fields */ }
Expand description

Get pixels out of a JPEG file

High-level wrapper for jpeg_decompress_struct

let d = Decompress::new_path("image.jpg")?;

Implementations§

source§

impl Decompress<()>

source

pub const fn builder() -> DecompressBuilder<'static>

This is DecompressBuilder::new()

source§

impl Decompress<BufReader<File>>

source

pub fn new_path<P: AsRef<Path>>(path: P) -> Result<Self>

Decode file at path

source

pub fn new_file(file: File) -> Result<Self>

Decode an already-opened file

source§

impl<'mem> Decompress<&'mem [u8]>

source

pub fn new_mem(mem: &'mem [u8]) -> Result<Self>

Decode from a JPEG file already in memory

source§

impl<R> Decompress<R>

source

pub fn new_reader(reader: R) -> Result<Self>
where R: BufRead,

Decode from an io::BufRead, which is BufReader wrapping any io::Read.

source

pub fn components(&self) -> &[CompInfo]

source

pub fn color_space(&self) -> COLOR_SPACE

source

pub fn gamma(&self) -> f64

It’s generally bogus in libjpeg

source

pub fn markers(&self) -> MarkerIter<'_>

Markers are available only if you enable them via with_markers()

source

pub fn size(&self) -> (usize, usize)

width,height

source

pub fn width(&self) -> usize

source

pub fn height(&self) -> usize

source

pub fn rgb(self) -> Result<DecompressStarted<R>>

Start decompression with conversion to RGB

source

pub fn to_colorspace( self, colorspace: ColorSpace ) -> Result<DecompressStarted<R>>

Start decompression with conversion to colorspace

source

pub fn rgba(self) -> Result<DecompressStarted<R>>

Start decompression with conversion to RGBA

source

pub fn grayscale(self) -> Result<DecompressStarted<R>>

Start decompression with conversion to grayscale.

source

pub fn dct_method(&mut self, method: DctMethod)

Selects the algorithm used for the DCT step.

source

pub fn do_fancy_upsampling(&mut self, value: bool)

source

pub fn do_block_smoothing(&mut self, value: bool)

If true, interblock smoothing is applied in early stages of decoding progressive JPEG files; if false, not. Default is true. Early progression stages look “fuzzy” with smoothing, “blocky” without. In any case, block smoothing ceases to be applied after the first few AC coefficients are known to full accuracy, so it is relevant only when using buffered-image mode for progressive images.

source

pub fn raw(self) -> Result<DecompressStarted<R>>

source

pub fn image(self) -> Result<Format<R>>

Start decompression without colorspace conversion

source

pub fn scale(&mut self, numerator: u8)

Rescales the output image by numerator / 8 during decompression. numerator must be between 1 and 16. Thus setting a value of 8 will result in an unscaled image.

Trait Implementations§

source§

impl<R> Drop for Decompress<R>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<R> RefUnwindSafe for Decompress<R>
where R: RefUnwindSafe,

§

impl<R> !Send for Decompress<R>

§

impl<R> !Sync for Decompress<R>

§

impl<R> Unpin for Decompress<R>

§

impl<R> UnwindSafe for Decompress<R>
where R: UnwindSafe,

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>,

§

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>,

§

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.