mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Docs: add avif and heif examples
This commit is contained in:
parent
0fe857c5ac
commit
4b38f56d02
@ -472,7 +472,19 @@ AVIF image sequences are not supported.
|
|||||||
* `options.effort` **[number][12]** CPU effort, between 0 (fastest) and 9 (slowest) (optional, default `4`)
|
* `options.effort` **[number][12]** CPU effort, between 0 (fastest) and 9 (slowest) (optional, default `4`)
|
||||||
* `options.chromaSubsampling` **[string][2]** set to '4:2:0' to use chroma subsampling (optional, default `'4:4:4'`)
|
* `options.chromaSubsampling` **[string][2]** set to '4:2:0' to use chroma subsampling (optional, default `'4:4:4'`)
|
||||||
|
|
||||||
<!---->
|
### Examples
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const data = await sharp(input)
|
||||||
|
.avif({ effort: 2 })
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const data = await sharp(input)
|
||||||
|
.avif({ lossless: true })
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
* Throws **[Error][4]** Invalid options
|
* Throws **[Error][4]** Invalid options
|
||||||
|
|
||||||
@ -486,7 +498,7 @@ Returns **Sharp** 
|
|||||||
|
|
||||||
Use these HEIF options for output image.
|
Use these HEIF options for output image.
|
||||||
|
|
||||||
Support for patent-encumbered HEIC images requires the use of a
|
Support for patent-encumbered HEIC images using `hevc` compression requires the use of a
|
||||||
globally-installed libvips compiled with support for libheif, libde265 and x265.
|
globally-installed libvips compiled with support for libheif, libde265 and x265.
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
@ -499,7 +511,13 @@ globally-installed libvips compiled with support for libheif, libde265 and x265.
|
|||||||
* `options.effort` **[number][12]** CPU effort, between 0 (fastest) and 9 (slowest) (optional, default `4`)
|
* `options.effort` **[number][12]** CPU effort, between 0 (fastest) and 9 (slowest) (optional, default `4`)
|
||||||
* `options.chromaSubsampling` **[string][2]** set to '4:2:0' to use chroma subsampling (optional, default `'4:4:4'`)
|
* `options.chromaSubsampling` **[string][2]** set to '4:2:0' to use chroma subsampling (optional, default `'4:4:4'`)
|
||||||
|
|
||||||
<!---->
|
### Examples
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const data = await sharp(input)
|
||||||
|
.heif({ compression: 'hevc' })
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
* Throws **[Error][4]** Invalid options
|
* Throws **[Error][4]** Invalid options
|
||||||
|
|
||||||
|
@ -825,6 +825,16 @@ function tiff (options) {
|
|||||||
*
|
*
|
||||||
* AVIF image sequences are not supported.
|
* AVIF image sequences are not supported.
|
||||||
*
|
*
|
||||||
|
* @example
|
||||||
|
* const data = await sharp(input)
|
||||||
|
* .avif({ effort: 2 })
|
||||||
|
* .toBuffer();
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const data = await sharp(input)
|
||||||
|
* .avif({ lossless: true })
|
||||||
|
* .toBuffer();
|
||||||
|
*
|
||||||
* @since 0.27.0
|
* @since 0.27.0
|
||||||
*
|
*
|
||||||
* @param {Object} [options] - output options
|
* @param {Object} [options] - output options
|
||||||
@ -842,9 +852,14 @@ function avif (options) {
|
|||||||
/**
|
/**
|
||||||
* Use these HEIF options for output image.
|
* Use these HEIF options for output image.
|
||||||
*
|
*
|
||||||
* Support for patent-encumbered HEIC images requires the use of a
|
* Support for patent-encumbered HEIC images using `hevc` compression requires the use of a
|
||||||
* globally-installed libvips compiled with support for libheif, libde265 and x265.
|
* globally-installed libvips compiled with support for libheif, libde265 and x265.
|
||||||
*
|
*
|
||||||
|
* @example
|
||||||
|
* const data = await sharp(input)
|
||||||
|
* .heif({ compression: 'hevc' })
|
||||||
|
* .toBuffer();
|
||||||
|
*
|
||||||
* @since 0.23.0
|
* @since 0.23.0
|
||||||
*
|
*
|
||||||
* @param {Object} [options] - output options
|
* @param {Object} [options] - output options
|
||||||
|
Loading…
x
Reference in New Issue
Block a user