# imagemin-webp

> WebP imagemin plugin

Latest version **8.0.0** (published 2023-01-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install imagemin-webp
pnpm add imagemin-webp
yarn add imagemin-webp
bun add imagemin-webp
```

## Health

**Score 28/100 (F)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 8.0.0 |
| Published | 2023-01-27 |
| First published | 2014-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/imagemin-webp) |
| Module format | ESM |
| Node | >=14.16 |
| Dependencies | 3 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 515 |
| Maintainers | nothingismagick, sindresorhus, kevva, 1000ch, xhmikosr, shinnn |
| Keywords | compress, cwebp, image, imageminplugin, img, jpg, minify, optimize, png, tif, webp |

## Links

- npm: https://www.npmjs.com/package/imagemin-webp
- Repository: https://github.com/imagemin/imagemin-webp
- Homepage: https://github.com/imagemin/imagemin-webp#readme
- Issues: https://github.com/imagemin/imagemin-webp/issues
- npm.io page: https://npm.io/package/imagemin-webp

## Dependencies (3)

- [cwebp-bin](https://npm.io/package/cwebp-bin.md) ^8.0.0
- [exec-buffer](https://npm.io/package/exec-buffer.md) ^3.2.0
- [is-cwebp-readable](https://npm.io/package/is-cwebp-readable.md) ^3.0.0

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 8.0.0 (latest) — 2023-01-27
- 6.0.1 — 2023-01-27
- 6.1.0 — 2023-01-27
- 7.0.0 — 2021-12-17
- 6.0.0 — 2020-05-24
- 5.1.0 — 2019-05-25
- 5.0.0 — 2018-11-30
- 4.1.0 — 2017-12-27
- 4.0.0 — 2016-05-25
- 3.1.1 — 2016-01-31
- 3.1.0 — 2015-07-01
- 3.0.3 — 2015-04-27
- 3.0.2 — 2015-04-26
- 3.0.1 — 2015-03-16
- 3.0.0 — 2014-10-24
- … 5 more at https://npm.io/package/imagemin-webp/versions

## README

# imagemin-webp ![GitHub Actions Status](https://github.com/imagemin/imagemin-webp/workflows/test/badge.svg?branch=main)

> WebP [imagemin](https://github.com/imagemin/imagemin) plugin

## Install

```sh
npm install imagemin-webp
```

## Usage

```js
import imagemin from 'imagemin';
import imageminWebp from 'imagemin-webp';

await imagemin(['images/*.{jpg,png}'], {
	destination: 'build/images',
	plugins: [
		imageminWebp({quality: 50})
	]
});

console.log('Images optimized');
```

## API

### imageminWebp(options?)(buffer)

Returns a `Promise<Buffer>` with the optimized image.

#### options

Type: `object`

##### preset

Type: `string`\
Default: `default`

Preset setting, one of `default`, `photo`, `picture`, `drawing`, `icon` and `text`.

##### quality

Type: `number`\
Default: `75`

Set quality factor between `0` and `100`.

##### alphaQuality

Type: `number`\
Default: `100`

Set transparency-compression quality between `0` and `100`.

##### method

Type: `number`\
Default: `4`

Specify the compression method to use, between `0` (fastest) and `6` (slowest). This parameter controls the trade off between encoding speed and the compressed file size and quality.

##### size

Type: `number`

Set target size in bytes.

##### sns

Type: `number`\
Default: `50`

Set the amplitude of spatial noise shaping between `0` and `100`.

##### filter

Type: `number`

Set deblocking filter strength between `0` (off) and `100`.

##### autoFilter

Type: `boolean`\
Default: `false`

Adjust filter strength automatically.

##### sharpness

Type: `number`\
Default: `0`

Set filter sharpness between `0` (sharpest) and `7` (least sharp).

##### lossless

Type: `boolean | number`\
Default: `false`

Encode images losslessly. If set to a number, activates lossless preset with given level between `0` (fastest, larger files) and `9` (slowest, smaller files).

##### nearLossless

Type: `number`\
Default: `100`

Encode losslessly with an additional [lossy pre-processing step](https://groups.google.com/a/webmproject.org/forum/#!msg/webp-discuss/0GmxDmlexek/3ggyYsaYdFEJ), with a quality factor between `0` (maximum pre-processing) and `100` (same as `lossless`).

##### crop

Type: `object { x: number, y: number, width: number, height: number }`

Crop the image.

##### resize

Type: `object { width: number, height: number }`

Resize the image. Happens after `crop`.

##### metadata

Type: `string | string[]`\
Default: `none`\
Values: `all` `none` `exif` `icc` `xmp`

A list of metadata to copy from the input to the output if present.

#### buffer

Type: `Buffer`

Buffer to optimize.

---
_Source: https://npm.io/package/imagemin-webp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
