[][src]Struct oxipng::Options

pub struct Options {
    pub backup: bool,
    pub fix_errors: bool,
    pub pretend: bool,
    pub clobber: bool,
    pub create: bool,
    pub force: bool,
    pub preserve_attrs: bool,
    pub verbosity: Option<u8>,
    pub filter: HashSet<u8>,
    pub interlace: Option<u8>,
    pub compression: HashSet<u8>,
    pub strategies: HashSet<u8>,
    pub window: u8,
    pub alphas: HashSet<AlphaOptim>,
    pub bit_depth_reduction: bool,
    pub color_type_reduction: bool,
    pub palette_reduction: bool,
    pub idat_recoding: bool,
    pub strip: Headers,
    pub deflate: Deflaters,
    pub use_heuristics: bool,
    pub threads: usize,
    pub timeout: Option<Duration>,
    // some fields omitted
}

Options controlling the output of the optimize function

Fields

backup: bool

Whether the input file should be backed up before writing the output.

Default: false

fix_errors: bool

Attempt to fix errors when decoding the input file rather than returning an Err.

Default: false

pretend: bool

Don't actually write any output, just calculate the best results.

Default: false

clobber: bool

Overwrite existing output files.

Default: true

create: bool

Create new output files if they don't exist.

Default: true

force: bool

Write to output even if there was no improvement in compression.

Default: false

preserve_attrs: bool

Ensure the output file has the same permissions as the input file.

Default: false

verbosity: Option<u8>

How verbose the console logging should be (None for quiet, Some(0) for normal, Some(1) for verbose)

Default: Some(0)

filter: HashSet<u8>

Which filters to try on the file (0-5)

Default: 0,5

interlace: Option<u8>

Whether to change the interlacing type of the file.

None will not change the current interlacing type.

Some(x) will change the file to interlacing mode x.

Default: None

compression: HashSet<u8>

Which zlib compression levels to try on the file (1-9)

Default: 9

strategies: HashSet<u8>

Which zlib compression strategies to try on the file (0-3)

Default: 0-3

window: u8

Window size to use when compressing the file, as 2^window bytes.

Doesn't affect compression but may affect speed and memory usage. 8-15 are valid values.

Default: 15

alphas: HashSet<AlphaOptim>

Alpha filtering strategies to use

bit_depth_reduction: bool

Whether to attempt bit depth reduction

Default: true

color_type_reduction: bool

Whether to attempt color type reduction

Default: true

palette_reduction: bool

Whether to attempt palette reduction

Default: true

idat_recoding: bool

Whether to perform IDAT recoding

If any type of reduction is performed, IDAT recoding will be performed regardless of this setting

Default: true

strip: Headers

Which headers to strip from the PNG file, if any

Default: None

deflate: Deflaters

Which DEFLATE algorithm to use

Default: Zlib

use_heuristics: bool

Whether to use heuristics to pick the best filter and compression

Intended for use with -o 1 from the CLI interface

Default: false

threads: usize

Number of threads to use

Default: number of CPU cores

timeout: Option<Duration>

Maximum amount of time to spend on optimizations. Further potential optimizations are skipped if the timeout is exceeded.

Methods

impl Options[src]

pub fn from_preset(level: u8) -> Options[src]

Trait Implementations

impl Default for Options[src]

impl Clone for Options[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Options[src]

Auto Trait Implementations

impl Send for Options

impl Unpin for Options

impl Sync for Options

impl UnwindSafe for Options

impl RefUnwindSafe for Options

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]