The lossy VP8 bitstream has no alpha channel, so an image with transparency stores its
alpha in an ALPH chunk just before the VP8 chunk. It should not
appear beside a VP8L bitstream, which carries its own alpha.
Layout
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 1 | bits | flags | See below. |
| 1 | chunk size − 1 | bytes | alpha data | Depends on the compression method. |
| Spec bits | Mask | Name | Values |
|---|---|---|---|
| 0–1 | C0 | Rsv | Must be 0; readers ignore them. |
| 2–3 | 30 | P, pre-processing | 0 none; 1 level reduction. Information only: a decoder may use it for dithering or smoothing but need not. |
| 4–5 | 0C | F, filtering | 0 none; 1 horizontal; 2 vertical; 3 gradient. |
| 6–7 | 03 | C, compression | 0 raw; 1 WebP lossless. |
Compression methods
| Value | Name | Data |
|---|---|---|
| 0 | Raw | width × height bytes in scan order. |
| 1 | WebP lossless | A VP8L image stream with no header and implicit dimensions. Alpha is read from the green channel of the decoded ARGB values. |
Filters
A is the pixel to the left, B the pixel above and C the pixel above and to the left. Each decoded alpha is the predictor plus the stored value, modulo 256.
| Value | Name | Predictor |
|---|---|---|
| 0 | None | 0 |
| 1 | Horizontal | A |
| 2 | Vertical | B |
| 3 | Gradient | clip(A + B − C), where clip limits the value to 0 to 255 |
| Position | Filter | Predictor used |
|---|---|---|
| Top-left pixel | Any | 0 |
| Left column | Horizontal, gradient | The pixel above |
| Top row | Vertical, gradient | The pixel to the left |