diff --git a/Cargo.toml b/Cargo.toml index 5c24e963..4938d02d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,6 +37,7 @@ zopfli = "^0.4.0" miniz_oxide = "0.2.0" rgb = "0.8.11" + [dependencies.rayon] optional = true version = "^1.0.0" diff --git a/src/reduction/alpha.rs b/src/reduction/alpha.rs index f0e62e22..b255e9f7 100644 --- a/src/reduction/alpha.rs +++ b/src/reduction/alpha.rs @@ -97,7 +97,7 @@ fn reduced_alpha_to_up(png: &PngImage, bpc: usize, bpp: usize) -> Vec { scan_lines.reverse(); let mut lines = Vec::with_capacity(scan_lines.len()); let mut last_line = Vec::new(); - let mut current_line = Vec::with_capacity(scan_lines[0].data.len()); + let mut current_line = Vec::with_capacity(scan_lines[0].data.len() + 1); // filter size + pixels for line in scan_lines { if line.data.len() != last_line.len() { last_line = vec![0; line.data.len()];