imagemin-mozjpeg

mozjpeg imagemin plugin

imagemin-mozjpeg

mozjpeg imagemin plugin

$ npm install --save imagemin-mozjpeg
var Imagemin = require('imagemin');
var imageminMozjpeg = require('imagemin-mozjpeg');
 
new Imagemin()
    .src('images/*.jpg')
    .dest('build/images')
    .use(imageminMozjpeg({quality: 80}))
    .run();

You can also use this plugin with gulp:

var gulp = require('gulp');
var imageminMozjpeg = require('imagemin-mozjpeg');
 
gulp.task('default', function () {
    return gulp.src('images/*.jpg')
        .pipe(imageminMozjpeg({quality: 80})())
        .pipe(gulp.dest('build/images'));
});

Type: number

Compression quality. Min and max are numbers in range 0 (worst) to 100 (perfect).

Type: boolean Default: true

false creates baseline JPEG file.

Type: boolean Default: false

Input file is Targa format (usually not needed).

Type: boolean Default: false

Revert to standard defaults instead of mozjpeg defaults.

Type: boolean
Default: false

Disable progressive scan optimization.

Type: number
Default: 1

Set DC scan optimization mode.

  • 0 One scan for all components
  • 1 One scan per component
  • 2 Optimize between one scan for all components and one scan for 1st component plus one scan for remaining components

Type: boolean
Default: false

Disable trellis optimization.

Type: boolean
Default: false

Disable trellis optimization of DC coefficients.

Type: string
Default: hvs-psnr

Set trellis optimization method. Available methods: psnr, hvs-psnr, ssim and ms-ssim

Type: boolean
Default: false

Disable black-on-white deringing via overshoot.

Type: boolean
Default: false

Use arithmetic coding.

Type: number

Use predefined quantization table.

  • 0 JPEG Annex K
  • 1 Flat
  • 2 Custom, tuned for MS-SSIM
  • 3 ImageMagick table by N. Robidoux
  • 4 Custom, tuned for PSNR-HVS
  • 5 Table from paper by Klein, Silverstein and Carney

Type: number

Set the strength of smooth dithered input. (1...100)

Type: number

Set the maximum memory to use in kbytes.

MIT © imagemin