Docs: add animated WebP example #2648

This commit is contained in:
Lovell Fuller 2021-04-01 16:04:46 +01:00
parent cd410080bd
commit 08a25a0c8f
3 changed files with 14 additions and 1 deletions

View File

@ -267,6 +267,13 @@ const data = await sharp(input)
.toBuffer(); .toBuffer();
``` ```
```javascript
// Optimise the file size of an animated WebP
const outputWebp = await sharp(inputWebp, { animated: true })
.webp({ reductionEffort: 6 })
.toBuffer();
```
- Throws **[Error][4]** Invalid options - Throws **[Error][4]** Invalid options
Returns **Sharp** Returns **Sharp**

File diff suppressed because one or more lines are too long

View File

@ -383,6 +383,12 @@ function png (options) {
* .webp({ lossless: true }) * .webp({ lossless: true })
* .toBuffer(); * .toBuffer();
* *
* @example
* // Optimise the file size of an animated WebP
* const outputWebp = await sharp(inputWebp, { animated: true })
* .webp({ reductionEffort: 6 })
* .toBuffer();
*
* @param {Object} [options] - output options * @param {Object} [options] - output options
* @param {number} [options.quality=80] - quality, integer 1-100 * @param {number} [options.quality=80] - quality, integer 1-100
* @param {number} [options.alphaQuality=100] - quality of alpha layer, integer 0-100 * @param {number} [options.alphaQuality=100] - quality of alpha layer, integer 0-100