Fixs and Improvements#345
Conversation
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
|
@vlad-salone READY. |
There was a problem hiding this comment.
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.
1. bump deps version 2. fix aarch pkg update config
|
GitHub Workflow Actions test status for this PR: https://github.com/Mikachu2333/rimage/actions/runs/25368190567 |
|
According to njaard/libavif-rs#122 and NixOS/nixpkgs#483922 , we need to wait until liavif update and then we can re-use |
1. remove `ilammy/setup-nasm@v1` 2. untangle steps and sort each 3. re-fix Mac build
|
Re-fix build on mac finished. |
This pull request updates dependencies, improves CI workflows, and enhances documentation for the
rimageproject. 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:
Cargo.tomlto their latest versions, includingzune-core,zune-image,fast_image_resize,oxipng,ravif,tiff,clap,rayon, andlittle_exif, for improved performance, compatibility, and bug fixes.0.12.4and marked0.12.xas supported inSECURITY.md. [1] [2]CI Workflow Improvements:
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]github/combine-prsaction to v5.2.0 for PR management.Documentation and Usability Enhancements:
--threadsCLI option to clarify its effect on concurrency and memory usage.--chroma_qualityargument 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