Skip to content

Commit

Permalink
Docs improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 7, 2019
1 parent 507d8ab commit e6c1b97
Showing 1 changed file with 29 additions and 24 deletions.
53 changes: 29 additions & 24 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ $ npm install imagemin-pngquant
const imagemin = require('imagemin');
const imageminPngquant = require('imagemin-pngquant');

imagemin(['images/*.png'], 'build/images', {use: [imageminPngquant()]}).then(() => {
(async () => {
await imagemin(['images/*.png'], 'build/images', {
plugins: [
imageminPngquant()
]
});

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


Expand All @@ -32,21 +38,20 @@ Returns a `Promise` for a `Buffer`.

Type: `Object`

##### dithering

Type: `number` `boolean`<br>
Default: `1` (full)
##### speed

Set the dithering level using a fractional number between 0 (none) and 1 (full).
Type: `number`<br>
Default: `3`<br>
Values: `1` (brute-force) to `11` (fastest)

Pass in `false` to disable dithering.
Speed `10` has 5% lower quality, but is about 8 times faster than the default. Speed `11` disables dithering and lowers compression level.

##### posterize
##### strip

Type: `number`
Type: `boolean`<br>
Default: `false`

Reduce precision of the palette by number of bits. Use when the image will be
displayed on low-depth screens (e.g. 16-bit displays or compressed textures).
Remove optional metadata.

##### quality

Expand All @@ -58,27 +63,27 @@ image won't be saved.

Min and max are numbers in range 0 (worst) to 100 (perfect), similar to JPEG.

##### speed
##### dithering

Type: `number`<br>
Default: `3`
Type: `number` `boolean`<br>
Default: `1` (full)

Speed/quality trade-off from `1` (brute-force) to `10` (fastest). Speed `10` has
5% lower quality, but is 8 times faster than the default.
Set the dithering level using a fractional number between 0 (none) and 1 (full).

##### verbose
Pass in `false` to disable dithering.

Type: `boolean`<br>
Default: `false`
##### posterize

Print verbose status messages.
Type: `number`

##### strip
Truncate number of least significant bits of color (per channel). Use this when image will be output on low-depth displays (e.g. 16-bit RGB). pngquant will make almost-opaque pixels fully opaque and will reduce amount of semi-transparent colors.

##### verbose

Type: `boolean`<br>
Default: `false` (`true` on macOS)
Default: `false`

Remove optional metadata.
Print verbose status messages.

#### input

Expand Down

0 comments on commit e6c1b97

Please sign in to comment.