Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fisker/imagemin-upng

upng imagemin plugin
https://github.com/fisker/imagemin-upng

imagemin

Last synced: 5 days ago
JSON representation

upng imagemin plugin

Awesome Lists containing this project

README

        

# imagemin-upng

> upng imagemin plugin

## Install

```bash
npm install --save imagemin-upng
```

## Usage

CLI

```bash
imagemin foo.png --plugin=upng > foo-optimized.png
```

API

```js
import imagemin from 'imagemin'
import imageminUpng from 'imagemin-upng'

const files = await imagemin(['images/*.png'], {
destination: 'build/images',
plugins: [imageminUpng()],
})

console.log(files)
//=> [{data: , destinationPath: 'build/images/foo.jpg'}, …]
```

## API

### imageminUpng([options])(buffer)

Returns a promise for a buffer.

#### options

##### cnum

Type: `number`
Default: `256`

number of colors in the result (0 = lossless, 256 = lossy).

#### buffer

Type: `Buffer`

Buffer to optimize.