OptionalalphaFor lossy compression, the alpha plane's quality (0-100, like cwebp's -alpha_q): below 100 its levels are
reduced (to 2-16 up to 70, 16-256 above), which makes it compress better; the alpha plane is lossless otherwise.
Default: 100
OptionaleffortHow much effort lossy compression takes (0-6, libwebp's method): higher is smaller but slower. 0-2 pick the
predictions by how close they are, 3 and up also by how many bits they take, 5 and 6 also optimize the
quantized values. Default: 2: about a quarter of the time of 4 (cwebp's default) for files about 5% larger
OptionalmetadataMetadata to include, see Metadata
OptionalqualityLossy compression (0-100, like libwebp's quality: 75 is its default): the image is encoded like cwebp encodes it
(with -m set to the effort), much smaller than lossless. Without it the image is encoded losslessly
OptionalsharpFor lossy compression: convert to YUV like libwebp's sharp conversion (cwebp's -sharp_yuv, the same file),
which picks the color planes so that colored edges (red text on blue, thin colored lines) stay sharp instead of
bleeding. It takes about twice the time at the default effort; photos get about as large, images with many
hard color edges a lot larger (1200x800 red and blue squares: 2.7 times). Default: false
OptionalthreadsFor lossless compression, at most this many worker threads search the predictors and prefix codes in parallel
(the same file, faster), 1 for none. Images under about 1.5 megapixels, and runtimes whose workers can't share
memory (browsers without cross-origin isolation), encode without them. Default: the processors available, at
most 8
Options of Image.encodeWebP