Skip to content

Commit

Permalink
added file-sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
Comeza committed Mar 9, 2021
1 parent 771a3d0 commit 590a014
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ edition = "2018"
[dependencies]
image = "*"
regex = "*"
alphanumeric-sort = "*"
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ fn main() {
match file {
Ok(file) => {
let path = file.path();
println!("indexing file {:?}", path);
if regex.is_match(path.to_str().unwrap()) {
println!("indexing file {:?}", path);
file_list.push(path);
}
}
Err(_) => {}
}
}

alphanumeric_sort::sort_path_slice(&mut file_list);

dimensions = image::open(file_list.first().unwrap())
.unwrap()
.dimensions();
Expand All @@ -40,7 +42,7 @@ fn main() {

for (i, file) in file_list.iter().enumerate() {
let load_time = Instant::now();
print!("processing {:?}", file);
print!("processing {:?}...", file);
let mut image = image::open(file).unwrap();
image::imageops::overlay(&mut image_buffer, &mut image, 0, dimensions.1 * i as u32);
println!(" done [{:?}]", load_time.elapsed());
Expand Down

0 comments on commit 590a014

Please sign in to comment.