Open nekowinston opened 8 months ago
This pull request introduces native Rust WebP encoding and decoding support using the image-webp
crate, as an alternative to the existing libwebp-sys2
implementation. The changes include new pure Rust WebP encoder and decoder implementations, updated tests, and modifications to the feature system to support both WebP implementations.
Change | Details | Files |
---|---|---|
Implement pure Rust WebP encoding and decoding |
|
src/encodings/mod.rs src/encodings/webp_pure.rs src/format.rs |
Update tests for new WebP implementation |
|
tests/test_webp.rs tests/test_webp-pure.rs |
Refactor test structure and common code |
|
tests/common/mod.rs tests/test_png.rs tests/test_gif.rs |
Update project metadata and documentation |
|
README.md rust-toolchain.toml |
Still a WIP, based on the recently released (and even more recently fixed)
image-webp
crate.Couple of notes:
webp-pure
as a mutually exclusive feature rather than a full replacement, asimage-webp
currently only supports lossless encoding.COLORS
static in./tests/test_png.rs
to a common module, since three files are now using the same contant, and usingmod png;
would also always run png tests when just testing withcargo test --test test_webp-pure --features all-pure
for me.We should probably wait for the release of image-webp v0.1.2/v0.2.0; I mainly wrote this PR for https://github.com/catppuccin/toolbox/pull/147, to compile that project to WASM with pure Rust webp support, without having to rely on ImageMagick.
Summary by Sourcery
Add support for Rust-native WebP encoding and decoding with the
image-webp
crate, introducing awebp-pure
feature for lossless encoding. Update the MSRV to v1.67.1 and refactor tests to use a common module for shared constants. Update documentation and add new tests for WebP functionality.New Features:
image-webp
crate, with a newwebp-pure
feature for lossless encoding.Enhancements:
Build:
image-webp
crate.Documentation:
webp-pure
feature alongside existing image encoding features.Tests:
webp-pure
feature.Chores:
rust-toolchain.toml
file to specify the Rust toolchain version and components required for the project.