From c7d462f909e9c6ebc8d32820d83a6119b681cad6 Mon Sep 17 00:00:00 2001 From: andrews05 Date: Sat, 26 Apr 2025 11:19:57 +1200 Subject: [PATCH] Bump version to 9.1.5 (#697) --- CHANGELOG.md | 7 +++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- MANUAL.txt | 12 ++++++++++-- src/headers.rs | 2 +- src/lib.rs | 18 +++++++----------- src/main.rs | 2 +- 7 files changed, 28 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bf05b8a..11228d6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## Version 9.1.5 + +- [Feature] Add `--sequential` option to process files sequentially rather than in parallel. +- [Performance] Update to latest Zopfli with greatly improved performance. +- [Improvement] Reduce memory usage. +- [Bugfix] Correct handling of grayscale conversion when ICC profile is present. + ## Version 9.1.4 - [Improvement] Improve optimization of APNG files (reductions still not supported yet). diff --git a/Cargo.lock b/Cargo.lock index 9ad149bf..9b916cc4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -394,7 +394,7 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "oxipng" -version = "9.1.4" +version = "9.1.5" dependencies = [ "bitvec", "clap", diff --git a/Cargo.toml b/Cargo.toml index c01e4966..7b808159 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ homepage = "https://github.com/shssoichiro/oxipng" license = "MIT" name = "oxipng" repository = "https://github.com/shssoichiro/oxipng" -version = "9.1.4" +version = "9.1.5" rust-version = "1.74.0" [badges] diff --git a/MANUAL.txt b/MANUAL.txt index 95b9abed..dd969663 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -1,4 +1,4 @@ -oxipng 9.1.4 +oxipng 9.1.5 Losslessly improve compression of PNG files Usage: oxipng [OPTIONS] ... @@ -182,7 +182,15 @@ Options: high compression levels. -t, --threads - Set number of threads to use [default: num CPU cores] + Set the maximum number of threads to use. Oxipng uses multithreading to evaluate multiple + optimizations on the same file in parallel as well as process multiple files in parallel. + You can set this to a lower value if you need to limit memory or CPU usage. + + [default: num logical CPUs] + + --sequential + Process multiple files sequentially rather than in parallel. Use this if you need + determinism in the processing order. Note this is not necessary if using '--threads 1'. -h, --help Print help (see a summary with '-h') diff --git a/src/headers.rs b/src/headers.rs index 2bfbda11..21786d4d 100644 --- a/src/headers.rs +++ b/src/headers.rs @@ -269,7 +269,7 @@ pub fn extract_icc(iccp: &Chunk) -> Option> { Ok(icc) => Some(icc), Err(e) => { // Log the error so we can know if the buffer size needs to be adjusted - warn!("Failed to decompress icc: {}", e); + warn!("Failed to decompress icc: {e}"); None } } diff --git a/src/lib.rs b/src/lib.rs index cd5d39d7..c3d6dba0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -183,7 +183,7 @@ impl RawImage { /// Perform optimization on the input file using the options provided pub fn optimize(input: &InFile, output: &OutFile, opts: &Options) -> PngResult<()> { // Read in the file and try to decode as PNG. - info!("Processing: {}", input); + info!("Processing: {input}"); let deadline = Arc::new(Deadline::new(opts.timeout)); @@ -207,7 +207,7 @@ pub fn optimize(input: &InFile, output: &OutFile, opts: &Options) -> PngResult<( )) }) .map(Some)?; - trace!("preserving metadata: {:?}", opt_metadata_preserved); + trace!("preserving metadata: {opt_metadata_preserved:?}"); } else { opt_metadata_preserved = None; } @@ -236,7 +236,7 @@ pub fn optimize(input: &InFile, output: &OutFile, opts: &Options) -> PngResult<( (OutFile::Path { path, .. }, InFile::Path(ref input_path)) if path.as_ref().map_or(true, |p| p == input_path) => { - info!("{}: Could not optimize further, no change written", input); + info!("{input}: Could not optimize further, no change written"); return Ok(()); } _ => { @@ -261,7 +261,7 @@ pub fn optimize(input: &InFile, output: &OutFile, opts: &Options) -> PngResult<( match (output, input) { (OutFile::None, _) => { - info!("{}: Running in pretend mode, no output", savings); + info!("{savings}: Running in pretend mode, no output"); } (&OutFile::StdOut, _) | (&OutFile::Path { path: None, .. }, &InFile::StdIn) => { let mut buffer = BufWriter::new(stdout()); @@ -346,8 +346,8 @@ fn optimize_png( raw.ihdr.width, raw.ihdr.height ); report_format(" ", &raw); - debug!(" IDAT size = {} bytes", idat_original_size); - debug!(" File size = {} bytes", file_original_size); + debug!(" IDAT size = {idat_original_size} bytes"); + debug!(" File size = {file_original_size} bytes"); let mut opts = opts.to_owned(); preprocess_chunks(&mut png.aux_chunks, &mut opts); @@ -681,11 +681,7 @@ fn copy_times(_: &Metadata, _: &Path) -> PngResult<()> { fn copy_times(input_path_meta: &Metadata, out_path: &Path) -> PngResult<()> { let atime = filetime::FileTime::from_last_access_time(input_path_meta); let mtime = filetime::FileTime::from_last_modification_time(input_path_meta); - trace!( - "attempting to set file times: atime: {:?}, mtime: {:?}", - atime, - mtime - ); + trace!("attempting to set file times: atime: {atime:?}, mtime: {mtime:?}"); filetime::set_file_times(out_path, atime, mtime).map_err(|err_io| { PngError::new(&format!( "unable to set file times on {out_path:?}: {err_io}" diff --git a/src/main.rs b/src/main.rs index 91b57126..52623a7d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,7 +47,7 @@ fn main() -> ExitCode { let (out_file, out_dir, opts) = match parse_opts_into_struct(&matches) { Ok(x) => x, Err(x) => { - error!("{}", x); + error!("{x}"); return ExitCode::FAILURE; } };