Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
23
third-party/vendor/image/examples/convert.rs
vendored
Normal file
23
third-party/vendor/image/examples/convert.rs
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
//! An example of opening an image.
|
||||
extern crate image;
|
||||
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
let (from, into) = if env::args_os().count() == 3 {
|
||||
(
|
||||
env::args_os().nth(1).unwrap(),
|
||||
env::args_os().nth(2).unwrap(),
|
||||
)
|
||||
} else {
|
||||
println!("Please enter a from and into path.");
|
||||
std::process::exit(1);
|
||||
};
|
||||
|
||||
// Use the open function to load an image from a Path.
|
||||
// ```open``` returns a dynamic image.
|
||||
let im = image::open(Path::new(&from)).unwrap();
|
||||
// Write the contents of this image using extension guessing.
|
||||
im.save(Path::new(&into)).unwrap();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue