| 1 |
# image-webp |
| 2 |
|
| 3 |
[](https://crates.io/crates/image-webp) |
| 4 |
[](https://docs.rs/image-webp) |
| 5 |
[](https://github.com/image-rs/image-webp/actions) |
| 6 |
|
| 7 |
This crate is an independent implementation of the WebP image format, written so |
| 8 |
that the `image` crate can have a pure-Rust WebP backend for both encoding and |
| 9 |
decoding. |
| 10 |
|
| 11 |
## Current Status |
| 12 |
|
| 13 |
* **Decoder:** Supports all WebP format features including both lossless and |
| 14 |
lossy compression, alpha channel, and animation. Both the "simple" and |
| 15 |
"extended" formats are handled, and it exposes methods to extract ICC, EXIF, |
| 16 |
and XMP chunks. Decoding speed is generally in the range of **70-100%** of the |
| 17 |
speed of libwebp. |
| 18 |
|
| 19 |
* **Encoder:** This crate only supports lossless encoding. The encoder |
| 20 |
implementation is relatively basic which makes it very fast, but it doesn't |
| 21 |
get as good compression ratios as libwebp can. Nonetheless, it often produces |
| 22 |
smaller files than PNG, even when compared against the slowest/highest |
| 23 |
compression options of PNG encoders. |
| 24 |
|
| 25 |
## Future possibilities |
| 26 |
|
| 27 |
* We continue to be interested in **optimizations** and **bug fixes** and hope |
| 28 |
the bring the decoder closer to parity with libwebp. |
| 29 |
|
| 30 |
* Another potential area is **animation encoding**. Much of the groundwork is in |
| 31 |
place for this, but it will require some additional work to implement. |
| 32 |
|
| 33 |
* We would like to add **lossy encoding** support, but this is a non-trivial |
| 34 |
task and would require a lot of work. If you are interested in helping with |
| 35 |
this, please get in touch! |
| 36 |
|
| 37 |
## Unsafe code |
| 38 |
|
| 39 |
Both this crate and all of its dependencies currently contain no unsafe code. |
| 40 |
|
| 41 |
NOTE: This isn't a guarantee that unsafe code will never be added. It may prove |
| 42 |
necessary in the future to improve performance, but we will always strive to |
| 43 |
minimize the use of unsafe code and ensure that it is well-tested and |
| 44 |
documented. |
| 45 |
|
| 46 |
``` |
| 47 |
$ cargo geiger |
| 48 |
|
| 49 |
Metric output format: x/y |
| 50 |
x = unsafe code used by the build |
| 51 |
y = total unsafe code found in the crate |
| 52 |
|
| 53 |
Symbols: |
| 54 |
🔒 = No `unsafe` usage found, declares #![forbid(unsafe_code)] |
| 55 |
❓ = No `unsafe` usage found, missing #![forbid(unsafe_code)] |
| 56 |
☢️ = `unsafe` usage found |
| 57 |
|
| 58 |
Functions Expressions Impls Traits Methods Dependency |
| 59 |
|
| 60 |
0/0 0/0 0/0 0/0 0/0 🔒 image-webp 0.2.3 |
| 61 |
0/0 0/0 0/0 0/0 0/0 🔒 ├── byteorder-lite 0.1.0 |
| 62 |
0/0 0/0 0/0 0/0 0/0 ❓ └── quick-error 2.0.1 |
| 63 |
|
| 64 |
0/0 0/0 0/0 0/0 0/0 |
| 65 |
``` |