WebpEncodeOptions
How ImageKodec.encodeWebp writes a WebP (#178).
With lossless the image goes into a VP8L chunk and decodes to the exact pixels it came from; quality, effort, sharpYuv, alphaQuality and alphaFilter then do nothing. Otherwise the colour goes into a lossy VP8 chunk, in YUV 4:2:0, and any alpha into an ALPH chunk beside it.
Throws
if quality, effort or alphaQuality is out of range
Properties
how the alpha plane is predicted before its lossless coding.
0 to 100: 100 keeps the alpha exact, and a lower value reduces the alpha to fewer levels, down to 2 at 0, as cwebp -alpha_q does. Fully opaque and fully transparent pixels stay exact at every value.
the background colour, as ARGB, that an animation's ANIM chunk carries. A player may show it outside the frames; ImageKodec and libwebp start from a transparent canvas.
1 (fast) to 3 (thorough), in the place of cwebp -m 2, -m 4 and -m 6. Every effort chooses each macroblock's modes by distortion plus the bits they cost. 1 codes in full only the three 4x4 modes whose prediction alone looks best, in one pass. 2 codes every mode, and adds a first pass that measures the token statistics, so the decisions of the second pass weigh the costs the frame will have. 3 also chooses each coefficient's level, among the nearest, the one below and zero, by distortion plus bits, about three times as slow as 2.