jay3332 / ril

Rust Imaging Library: A high-level imaging crate for Rust.
https://crates.io/crates/ril
MIT License
81 stars 10 forks source link

feat: use rust native webp en/decoding #31

Open nekowinston opened 8 months ago

nekowinston commented 8 months ago

Still a WIP, based on the recently released (and even more recently fixed) image-webp crate.

Couple of notes:

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 a webp-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:

Enhancements:

Build:

Documentation:

Tests:

Chores:

sourcery-ai[bot] commented 2 months ago

Reviewer's Guide by Sourcery

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.

File-Level Changes

Change Details Files
Implement pure Rust WebP encoding and decoding
  • Add new webp_pure module with WebP encoder and decoder implementations
  • Update feature system to support both webp and webp-pure features
  • Implement WebPStaticEncoder, WebPDecoder, and WebPSequenceDecoder structs
  • Add error handling for mutually exclusive webp and webp-pure features
src/encodings/mod.rs
src/encodings/webp_pure.rs
src/format.rs
Update tests for new WebP implementation
  • Add new test file for pure Rust WebP implementation
  • Update existing WebP tests to use new reference images
  • Implement tests for both lossless and lossy WebP encoding/decoding
tests/test_webp.rs
tests/test_webp-pure.rs
Refactor test structure and common code
  • Move COLORS constant to a new common module
  • Update test files to use the new common module
tests/common/mod.rs
tests/test_png.rs
tests/test_gif.rs
Update project metadata and documentation
  • Bump MSRV to 1.67.1
  • Update README with new WebP feature information
  • Add rust-toolchain.toml file
README.md
rust-toolchain.toml

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.