• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

src/H03-May-2022-1,9921,266

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D15-Mar-202074 65

.gitignoreH A D08-Feb-202031 53

.travis.ymlH A D01-Mar-20203.3 KiB6764

CHANGELOG.mdH A D15-Mar-2020494 2215

Cargo.tomlH A D15-Mar-20201.6 KiB5146

Cargo.toml.orig-cargoH A D15-Mar-20201.1 KiB3932

README.mdH A D15-Mar-20204.3 KiB178151

README.md

1# libwebp
2
3This is a binding to [the libwebp library](https://developers.google.com/speed/webp/download).
4
5## Usage
6
7### Preparation
8
9```toml
10# Cargo.toml
11
12[dependencies]
13libwebp = { version = "0.1.2", features = ["0_6"] }
14```
15
16### Simple decoding
17
18```rust
19use libwebp::WebPDecodeRGBA;
20
21let data: &[u8];
22
23let (width, height, buf) = WebPDecodeRGBA(data).unwrap();
24eprintln!("width = {}, height = {}", width, height);
25eprintln!(
26    "top-left pixel: rgba({}, {}, {}, {})",
27    buf[0],
28    buf[1],
29    buf[2],
30    buf[3] as f64 / 255.0,
31)
32```
33
34### Simple encoding
35
36```rust
37use libwebp::WebPEncodeRGBA;
38
39let buf: &[u8] = &[
40    255, 255, 255, 255, // white
41    255, 0, 0, 255, // red
42    0, 255, 0, 255, // green
43    0, 0, 255, 255, // blue
44];
45let data = WebPEncodeRGBA(buf, 2, 2, 8, 75.0).unwrap();
46let lossless_data = WebPEncodeLosslessRGBA(buf, 2, 2, 8).unwrap();
47```
48
49## Minimum Supported Rust Version (MSRV)
50
51Rust 1.31.0
52
53## Features
54
55- `demux` ... enables `libwebpdemux` functions.
56- `mux` ... enables `libwebpmux` functions.
57- `0_5` ... enables functions introduced in libwebp 0.5.0.
58- `0_6` ... enables functions introduced in libwebp 0.6.0.
59- `1_1` ... enables functions introduced in libwebp 1.1.0.
60- `static` ... statically link against the bundled libwebp.
61- `extern-types` ... enables `#![feature(extern_types)]`.
62
63## Linking
64
65If libwebp is found in the system, it links against the library.
66Otherwise it builds and links against the bundled libwebp.
67
68In these cases, static link is preferred:
69
70- For musl target.
71- When cross-compiling.
72- `static` feature is turned on.
73- `LIBWEBP_SYS_STATIC` environment variable is set to `1` when building.
74
75## Related repositories
76
77- https://github.com/qnighy/libwebp-sys2-rs
78- https://github.com/qnighy/libwebp-image-rs
79
80## Completeness
81
82- `types.h`
83  - [ ] `WebPMalloc`
84  - [x] `WebPFree`
85- `decode.h`
86  - [x] `WebPGetDecoderVersion`
87  - [x] `WebPGetInfo`
88  - [x] `WebPDecode*`
89  - [x] `WebPDecodeYUV`
90  - [x] `WebPDecode*Into`
91  - [x] `WebPDecodeYUVInto`
92  - [x] `WEBP_CSP_MODE`
93  - [x] `WebPIsPremultipliedMode`
94  - [x] `WebPIsAlphaMode`
95  - [x] `WebPIsRGBMode`
96  - [ ] `WebPRGBABuffer`
97  - [ ] `WebPYUVABuffer`
98  - [ ] `WebPDecBuffer`
99  - [ ] `WebPInitDecBuffer`
100  - [ ] `WebPFreeDecBuffer`
101  - [x] `VP8StatusCode`
102  - [x] `WebPIDecoder` (internal memory)
103  - [ ] `WebPIDecoder` (external memory)
104  - [x] `WebPINewDecoder` (internal memory)
105  - [ ] `WebPINewDecoder` (external memory)
106  - [x] `WebPINewRGB` (internal memory)
107  - [ ] `WebPINewRGB` (external memory)
108  - [x] `WebPINewYUVA` (internal memory)
109  - [ ] `WebPINewYUVA` (external memory)
110  - [x] `WebPIDelete`
111  - [x] `WebPIAppend`
112  - [ ] `WebPIUpdate`
113  - [x] `WebPIDecGetRGB`
114  - [x] `WebPIDecGetYUVA`
115  - [ ] `WebPIDecodedArea`
116  - [ ] `WebPBitstreamFeatures`
117  - [ ] `WebPGetFeatures`
118  - [ ] `WebPDecoderOptions`
119  - [ ] `WebPDecoderConfig`
120  - [ ] `WebPInitDecoderConfig`
121  - [ ] `WebPIDecode`
122  - [ ] `WebPDecode`
123- `encode.h`
124  - [x] `WebPGetEncoderVersion`
125  - [x] `WebPEncode*`
126  - [x] `WebPEncodeLossless*`
127  - [ ] `WebPImageHint`
128  - [ ] `WebPConfig`
129  - [ ] `WebPPreset`
130  - [ ] `WebPConfigInit`
131  - [ ] `WebPConfigPreset`
132  - [ ] `WebPConfigLosslessPreset`
133  - [ ] `WebPValidateConfig`
134  - [ ] `WebPAuxStats`
135  - [ ] `WebPWriterFunction`
136  - [ ] `WebPMemoryWriter`
137  - [ ] `WebPMemoryWriterInit`
138  - [ ] `WebPMemoryWriterClear`
139  - [ ] `WebPMemoryWrite`
140  - [ ] `WebPProgressHook`
141  - [ ] `WebPEncCSP`
142  - [ ] `WebPEncodingError`
143  - [ ] `WEBP_MAX_DIMENSION`
144  - [ ] `WebPPicture`
145  - [ ] `WebPPictureInit`
146  - [ ] `WebPPictureAlloc`
147  - [ ] `WebPPictureFree`
148  - [ ] `WebPPictureCopy`
149  - [ ] `WebPPlaneDistortion`
150  - [ ] `WebPPictureDistortion`
151  - [ ] `WebPPictureCrop`
152  - [ ] `WebPPictureView`
153  - [ ] `WebPPictureIsView`
154  - [ ] `WebPPictureRescale`
155  - [ ] `WebPPictureImportRGB`
156  - [ ] `WebPPictureImportRGBA`
157  - [ ] `WebPPictureImportRGBX`
158  - [ ] `WebPPictureImportBGR`
159  - [ ] `WebPPictureImportBGRA`
160  - [ ] `WebPPictureImportBGRX`
161  - [ ] `WebPPictureARGBToYUVA`
162  - [ ] `WebPPictureARGBToYUVADithered`
163  - [ ] `WebPPictureSharpARGBToYUVA`
164  - [ ] `WebPPictureSmartARGBToYUVA`
165  - [ ] `WebPPictureYUVAToARGB`
166  - [ ] `WebPCleanupTransparentArea`
167  - [ ] `WebPPictureHasTransparency`
168  - [ ] `WebPBlendAlpha`
169  - [ ] `WebPEncode`
170- `mux_types.h`
171  - Not at all
172- `demux.h`
173  - Not at all
174- `mux.h`
175  - Not at all
176
177
178