WebpEncodeOptions

class WebpEncodeOptions(val lossless: Boolean = false, val quality: Int = 75, val effort: Int = 2, val sharpYuv: Boolean = false, val alphaQuality: Int = 100, val alphaFilter: WebpAlphaFilter = WebpAlphaFilter.Fast, val background: Int = 0)(source)

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

Constructors

Link copied to clipboard
constructor(lossless: Boolean = false, quality: Int = 75, effort: Int = 2, sharpYuv: Boolean = false, alphaQuality: Int = 100, alphaFilter: WebpAlphaFilter = WebpAlphaFilter.Fast, background: Int = 0)

Properties

Link copied to clipboard

how the alpha plane is predicted before its lossless coding.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard
val effort: Int

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.

Link copied to clipboard

write the lossless format instead of the lossy one.

Link copied to clipboard

0 to 100, higher is better and larger, with the meaning of cwebp -q: the same number gives about the same quantizer as libwebp chooses.

Link copied to clipboard

convert to YUV 4:2:0 by an iterative search that keeps colour edges sharper after the decoder's upsampling, as cwebp -sharp_yuv does. Slower to encode.

Functions

Link copied to clipboard
open override fun toString(): String