[−][src]Struct dither::prelude::Opt
Command-line interface & arguments. See structopt.
Fields
verbose: bool
Provide verbose debug information. Default is false.
input: PathBuf
Input file. Supported file types:
PNG
JPEG
GIF
BMP
ICO
TIFF
bit_depth: u8
Color depth. Must be between 1 and 8. See create_quantize_n_bits_func and create_convert_quantized_to_palette_func
output: Option<PathBuf>
Output file: will be written to as a .png or .jpg (inferred from file extension). If left empty, a default output path will be created: see Opt::output_path
ditherer: Ditherer<'static>
Ditherering algorithm to use. Options are
- "floyd" (default)
- "atkinson"
- "stucki",
- "burkes"
- "jarvis"
- "sierra3"
color_mode: Mode
Color mode to use. Options are -"bw" -> grayscale (black and white if bit-depth = 1)
- $COLOR => single-color mode. options are
- "BLUE"
- "GREEN"
- "CYAN"
- "RED"
- "MAGENTA"
- "BROWN",
- "LIGHT_GRAY"
- "GRAY"
- "LIGHT_BLUE",
- "LIGHT_GREEN"
- "LIGHT_CYAN",
- "LIGHT_RED"
- "LIGHT_MAGENTA"
- "YELLOW"
- "WHITE"
- ("0xYYYYYY 0xZZZZZZ") -> user specified 1bit user color palette; where the first is foreground in hexidecimal and the second is background.
- "cga" -> sixteen-color CGA. ignores bit depth; causes error on bit depth > 1
Methods
impl Opt
[src]
pub fn input_path(&self) -> Result<String>
[src]
the canonical input path.
pub fn output_path(&self) -> Result<String>
[src]
the actual output path. if opts.output exists, this is the the canonical version of that; otherwise, this is
"{base}_dithered_{dither}_{color}_{depth}.png"
,
where base is the canonicalized input path, stripped of it's extension.
$dither bunny.png --color=color --dither=atkinson --depth=2
will save to bunny_atkinson_c_2.png
let mut opt = Opt::default(); opt.bit_depth=1; opt.input = PathBuf::from("bunny.png".to_string()); let got_path = PathBuf::from(opt.output_path().unwrap()); assert_eq!("bunny_dithered_floyd_bw_1.png", got_path.file_name().unwrap().to_string_lossy());
Trait Implementations
impl PartialEq<Opt> for Opt
[src]
impl Default for Opt
[src]
impl Clone for Opt
[src]
fn clone(&self) -> Opt
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Opt
[src]
impl StructOpt for Opt
[src]
fn clap<'a, 'b>() -> App<'a, 'b>
[src]
fn from_clap(matches: &ArgMatches) -> Self
[src]
fn from_args() -> Self
[src]
Gets the struct from the command line arguments. Print the error message and quit the program in case of failure. Read more
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
[src]
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
Gets the struct from any iterator such as a Vec
of your making. Print the error message and quit the program in case of failure. Read more
fn from_iter_safe<I>(iter: I) -> Result<Self, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
[src]
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
Gets the struct from any iterator such as a Vec
of your making. Read more
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.