avifenc imagemin plugin
npm install @vheemstra/imagemin-avifenc> AVIF encoding imagemin plugin using avifenc from AOMedia's libavif.
```
$ npm install --save @vheemstra/imagemin-avifenc
`js
import imagemin from 'imagemin';
import imageminAvifenc from '@vheemstra/imagemin-avifenc';
(async () => {
await imagemin(['images/*.{jpg,jpeg,png}'], {
destination: 'build/images',
plugins: [
imageminAvifenc()
]
});
console.log('Images converted!');
})();
`
Returns a Promise with the converted image.
#### options
Type: object
For full option description, see avifenc's syntax method
##### jobs
Type: number or 'all'1
Default:
Number of jobs (worker threads). Use 'all' to use all available cores.
##### lossless
Type: booleanfalse
Default:
Set all defaults to encode losslessly, and emit warnings when settings/input don't allow for it.
##### depth
Type: number
Default: taken from input image
Output depth (8, 10 or 12).
##### min
Type: number0
Default:
Set min quantizer for color (0 to 63, where 0 is lossless).
##### max
Type: number10
Default:
Set max quantizer for color (0 to 63, where 0 is lossless).
##### minalpha
Type: number0
Default:
Set min quantizer for alpha (0 to 63, where 0 is lossless).
##### maxalpha
Type: number0
Default:
Set max quantizer for alpha (0 to 63, where 0 is lossless).
##### qcolor
Type: number
Set quality for color (0 to 100, where 100 is lossless).
##### qalpha
Type: number
Set quality for alpha (0 to 100, where 100 is lossless).
##### tilerowslog2
Type: number0
Default:
Set log2 of number of tile rows (0 to 6).
##### tilecolslog2
Type: number0
Default:
Set log2 of number of tile columns (0 to 6).
##### autotiling
Type: boolean
Set tilerowslog2 and tilecolslog2 automatically.
##### cicp
Type: array of numbersnull
Default:
Set CICP values (nclx colr box). Order of enums: avifColorPrimaries, avifTransferCharacteristics, avifMatrixCoefficients.
Use 2 for any you wish to leave unspecified.
##### nclx
Synonym for cicp
##### premultiply
Type: boolean
Premultiply color by the alpha channel and signal this in the AVIF.
##### range
Type: stringfull
Default:
YUV range (full or limited).
##### yuv
Type: number or 'auto''auto'
Default:
Output format (444, 422, 420 or 400).auto
For JPEG, honors the JPEG's internal format, if possible.auto
For all other cases, defaults to 444
##### sharpyuv
Type: boolean
Use sharp RGB to YUV420 conversion (if supported). Ignored if output is not 420.
##### speed
Type: number or 'default'8
Default:
Encoder speed (slowest 0 to fastest 10). For codec internal defaults set to 'default'.
##### codec
Type: stringaom
Default:
AV1 codec to use, choose from:
* aom - version 2.0.0
##### exif
Type: stringnull
Default:
Provide an absolute path to Exif metadata payload file to be associated with the primary item.
##### xmp
Type: stringnull
Default:
Provide an absolute path to XMP metadata payload file to be associated with the primary item.
##### icc
Type: stringnull
Default:
Provide an absolute path to ICC profile payload file to be associated with the primary item.
##### ignore-exif
Type: booleanfalse
Default:
If the input file contains embedded Exif metadata, ignore it (no-op if absent).
##### ignore-xmp
Type: booleanfalse
Default:
If the input file contains embedded XMP metadata, ignore it (no-op if absent).
##### ignore-icc
Type: booleanfalse
Default:
If the input file contains an embedded ICC profile, ignore it (no-op if absent).
##### pasp
Type: array of 2 numbersnull
Default:
Set aspect ratio. Order: Horizontal spacing, Vertical spacing.
##### clap
Type: array of 8 numbersnull
Default:
Set clean aperture.
Order: Width, Height, HOffset, VOffset (in num/denom pairs).
##### crop
Type: array of 4 numbersnull
Default:
Set clean aperture, but calculated from a crop rectangle.
Order: X, Y, Width, Height.
##### irot
Type: numbernull
Default:
Set rotation (0 to 3). Makes (90 * irot) degree rotation anti-clockwise. Default: no rotation.
##### imir
Type: numbernull
Default:
Set mirroring (0 = vertical or 1 = horizontal). Default: no mirroring.
##### advanced
Type: objectnull
Default:
Object containing codec-specific key/value pairs to pass directly to the codec.
For aom these can be:``
{
'aq-mode': ..., // Adaptive quantization mode (0: off (default), 1: variance, 2: complexity, 3: cyclic refresh)
'cq-level': ..., // Constant/Constrained Quality level (0-63, end-usage must be set to cq or q)
'enable-chroma-deltaq': ..., // Enable delta quantization in chroma planes (0: disable (default), 1: enable)
'end-usage': ..., // Rate control mode (vbr, cbr, cq, or q)
'sharpness': ..., // Loop filter sharpness (0-7, default: 0)
'tune': ... // Tune the encoder for distortion metric (psnr or ssim, default: psnr)
}
#### buffer
Type: Buffer`
Buffer to optimize.
MIT © imagemin
libavif © 2019 Joe Drago (Released under the BSD License.)
This package is made by Philip van Heemstra
Based on imagemin-jpegtran by Sindre Sorhus