Skip to content

Fixs and Improvements#345

Open
Mikachu2333 wants to merge 27 commits into
vlad-salone:mainfrom
Mikachu2333:main
Open

Fixs and Improvements#345
Mikachu2333 wants to merge 27 commits into
vlad-salone:mainfrom
Mikachu2333:main

Conversation

@Mikachu2333
Copy link
Copy Markdown
Collaborator

@Mikachu2333 Mikachu2333 commented Apr 29, 2026

This pull request updates dependencies, improves CI workflows, and enhances documentation for the rimage project. The most significant changes include major dependency upgrades, improved GitHub Actions workflows for building and releasing, and clearer documentation for end users and contributors.

Dependency and Build System Updates:

  • Upgraded several core dependencies in Cargo.toml to their latest versions, including zune-core, zune-image, fast_image_resize, oxipng, ravif, tiff, clap, rayon, and little_exif, for improved performance, compatibility, and bug fixes.
  • Bumped the crate version to 0.12.4 and marked 0.12.x as supported in SECURITY.md. [1] [2]

CI Workflow Improvements:

  • Updated GitHub Actions workflows to use newer action versions (actions/checkout@v6, softprops/action-gh-release@v3, actions-rust-lang/setup-rust-toolchain@v1), improved caching, and modernized multiarch setup for cross-compilation. [1] [2] [3] [4] [5] [6] [7]
  • Improved artifact naming for clarity and consistency in build and release jobs. [1] [2]
  • Enhanced workflow triggers to include PRs that are reopened or marked ready for review.
  • Upgraded the github/combine-prs action to v5.2.0 for PR management.

Documentation and Usability Enhancements:

  • Expanded and clarified the README with detailed explanations of the preprocessing pipeline, quantization, pipeline ordering, and added a comprehensive Windows build guide. [1] [2] [3]
  • Improved the description and help text for the --threads CLI option to clarify its effect on concurrency and memory usage.
  • Fixed a typo in the --chroma_quality argument description.

These changes collectively improve the development experience, CI reliability, and end-user guidance for working with rimage.

CLOSE:

ISSUE:
close #339
close #340
close #341
close #342
close #343

PR:
re-close #334
close #352
close #353
close #354
close #355
close #256

Copilot AI review requested due to automatic review settings April 29, 2026 15:19
@Mikachu2333 Mikachu2333 self-assigned this Apr 29, 2026

This comment was marked as outdated.

@Mikachu2333 Mikachu2333 changed the title deps: update zune-image version to stable Fixs and Improvements Apr 29, 2026
@Mikachu2333 Mikachu2333 requested a review from Copilot April 29, 2026 16:24

This comment was marked as outdated.

@Mikachu2333 Mikachu2333 marked this pull request as draft April 29, 2026 17:36
Path normalization:
- normalize_path() resolves ~, relative paths, and canonicalizes
- expand_tilde_in_path() handles ~ on both Windows and Unix
- join_normalized() resolves ./ and ../ components
- Operates on already-parsed PathBuf values after clap parsing,
  avoiding fragile string-based pre-processing of all CLI args

Bounded concurrency (OOM prevention):
- Replaced unbounded rayon ParallelIterator with sequential
  file loop + ConcurrencyLimiter (Mutex<isize> + Condvar)
- Default --threads 1 processes one image at a time, preventing
  OOM when handling large images
- --threads N enables up to N concurrent images for speed
- Replaced 8 unreachable!() calls with proper Err returns
  (mozjpeg/avif colorspace, qtable, alpha_mode, oxipng depth)
- Changed unwrap() to unwrap_or() for robustness in encoder
  parameter handling (quality, speed, colorspace, alpha_mode)
- Fixed race condition in little_exif error suppression
- Fixed crashes: canonicalize on non-existent paths,
  file_stem/extension unwraps, output parent unwrap
- Fixed animated image channel count (num_components)
- Fixed webp animation loop_count (0 = infinite)
- Fixed UNC path corruption on Windows
- Added log::warn when animated images are flattened
- Merged dual Arc<Mutex<>> into ProcessingState struct
- Added unsafe block documentation and bounds checks
- Thread count changed from u8 to usize
- ResizeValue regex patterns moved to LazyLock statics
- Removed misleading EXIF/ICC log warnings (handled by main)
Custom quantization tables scaled to high quality (q > 80)
can produce values approaching the JPEG minimum of 1, allowing
DCT coefficient overflow. Apply proportional smoothing to
dampen high frequencies before quantization:

  min_smoothing = (quality - 75) * 0.4
  q85 -> ~4, q90 -> ~6, q95 -> ~8, q100 -> ~10

Replaces the previous fixed smoothing >= 10 threshold.
- Bumped zune-core and zune-image dependencies
- Aligned dev-dependency versions with primary dependencies
- Added Claude Code settings to .gitignore
- Updated SECURITY.md
- Code formatting fixes

This comment was marked as outdated.

@Mikachu2333
Copy link
Copy Markdown
Collaborator Author

@vlad-salone READY.

@Mikachu2333 Mikachu2333 marked this pull request as ready for review May 1, 2026 05:19
@Mikachu2333 Mikachu2333 requested a review from Copilot May 1, 2026 05:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on improving the CLI’s robustness and user feedback while updating dependencies and documentation. It notably adjusts path handling, reduces unsafe unwrap() usage in CLI parsing, and adds warnings/fail-fast errors for unsupported scenarios (e.g., animation in single-frame encoders).

Changes:

  • Improve CLI argument handling and error reporting (defaults + clearer errors instead of unwrap()/unreachable!()).
  • Adjust processing behavior to reduce OOM risk (thread/concurrency handling + path normalization).
  • Update dependencies and refresh docs/help text.

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/test_utils.rs Make animated test image channel count match the requested colorspace.
src/operations/resize/mod.rs Add SAFETY rationale comments around unsafe channel aliasing during resize.
src/operations/quantize/mod.rs Refactor palette remap loop; add SAFETY comment + debug assertion.
src/operations/icc/mod.rs Replace unreachable!() with a user-facing error for unsupported formats.
src/main.rs Add path normalization utilities, rework parallel processing, add failure summary output, default threads behavior.
src/codecs/webp/encoder/mod.rs Adjust WebP animation loop count and per-frame delay.
src/codecs/webp/decoder/mod.rs Avoid panics when a WebP has no frames; return structured decode errors.
src/codecs/oxipng/encoder/mod.rs Warn on animated input; return an error instead of unreachable!() for unsupported bit depths.
src/codecs/mozjpeg/encoder/mod.rs Warn on animated input; refine smoothing logic for high-quality + custom qtables.
src/codecs/avif/encoder/mod.rs Warn on animated input.
src/cli/utils/paths/mod.rs Switch get_paths from parallel iterator to sequential iterator.
src/cli/preprocessors/resize/value.rs Use static LazyLock<Regex> to avoid recompiling regexes.
src/cli/preprocessors/mod.rs Clarify help text for upscale/quantization/dithering behavior.
src/cli/pipeline.rs Make encoder option parsing more fault-tolerant with defaults + explicit errors.
src/cli/common.rs Redefine --threads help text and default behavior (limit concurrent images).
src/cli/codecs/mozjpeg.rs Fix typo: “chrome” → “chroma” quality.
SECURITY.md Mark 0.12.x as supported.
README.md Expand preprocessing docs and add Windows build steps.
Cargo.toml Update zune-* dependency versions/features; remove dev-dependencies block; minor formatting changes.
.gitignore Add Claude-related ignore entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main.rs
Comment thread src/operations/quantize/mod.rs
Comment thread README.md Outdated
Comment thread src/main.rs
Comment thread src/main.rs Outdated
@Mikachu2333 Mikachu2333 requested a review from vlad-salone May 1, 2026 13:45
1. bump deps version
2. fix aarch pkg update config
@Mikachu2333
Copy link
Copy Markdown
Collaborator Author

Mikachu2333 commented May 2, 2026

GitHub Workflow Actions test status for this PR: https://github.com/Mikachu2333/rimage/actions/runs/25368190567

@Mikachu2333
Copy link
Copy Markdown
Collaborator Author

Mikachu2333 commented May 4, 2026

According to njaard/libavif-rs#122 and NixOS/nixpkgs#483922 , we need to wait until liavif update and then we can re-use ilammy/setup-nasm@1. Otherwise, install nasm manually on macos with version 2.16 is necessary.

1. remove `ilammy/setup-nasm@v1`
2. untangle steps and sort each
3. re-fix Mac build
@Mikachu2333
Copy link
Copy Markdown
Collaborator Author

Re-fix build on mac finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants