Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imagemin/imagemin-jpeg-recompress
jpeg-recompress imagemin plugin
https://github.com/imagemin/imagemin-jpeg-recompress
Last synced: 3 days ago
JSON representation
jpeg-recompress imagemin plugin
- Host: GitHub
- URL: https://github.com/imagemin/imagemin-jpeg-recompress
- Owner: imagemin
- License: mit
- Created: 2014-05-24T09:57:47.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2023-01-26T04:28:49.000Z (almost 2 years ago)
- Last Synced: 2024-11-09T19:07:51.588Z (3 days ago)
- Language: JavaScript
- Homepage: https://github.com/danielgtaylor/jpeg-archive#jpeg-recompress
- Size: 1.1 MB
- Stars: 63
- Watchers: 8
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# imagemin-jpeg-recompress
> jpeg-recompress imagemin plugin
## Install
```
$ npm install --save imagemin-jpeg-recompress
```## Usage
```js
const imagemin = require('imagemin');
const imageminJpegRecompress = require('imagemin-jpeg-recompress');(async () => {
await imagemin(['images/*.jpg'], {
destination: 'build/images',
plugins: [
imageminJpegRecompress()
]
});console.log('Images optimized');
})();
```## API
### imageminJpegRecompress(options?)(buffer)
#### options
##### accurate
Type: `boolean`\
Default: `false`Favor accuracy over speed.
##### quality
Type: `string`\
Default: `medium`Set a quality preset. Available presets: `low`, `medium`, `high` and `veryhigh`.
##### method
Type: `string`\
Default: `ssim`Set [comparison method](https://github.com/danielgtaylor/jpeg-archive#image-comparison-metrics). Available methods: `mpe`, `ssim`, `ms-ssim` and `smallfry`.
##### target
Type: `number`\
Default: `0.9999`Set target quality.
##### min
Type: `number`\
Default: `40`Minimum JPEG quality.
##### max
Type: `number`\
Default: `95`Maximum JPEG quality.
##### loops
Type: `number`\
Default: `6`Set the number of attempts.
##### defish
Type: `number`\
Default: `0`Set defish strength.
##### progressive
Type: `boolean`\
Default: `true`Enable progressive encoding.
##### subsample
Type: `string`\
Default: `default`Set subsampling method. Available values: `default`, `disable`.
##### strip
Type: `boolean`\
Default: `true`Strips metadata, such as EXIF data.
#### buffer
Type: `buffer`
Buffer to optimize.