• Stars
    star
    251
  • Rank 161,862 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Imagemin plugin for mozjpeg

imagemin-mozjpeg

Imagemin plugin for mozjpeg

Install

$ npm install imagemin-mozjpeg

Usage

import imagemin from 'imagemin';
import imageminMozjpeg from 'imagemin-mozjpeg';

(async () => {
	await imagemin(['images/*.jpg'], {
		destination: 'build/images',
		plugins: [
			imageminMozjpeg()
		]
	});

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

API

imageminMozjpeg(options?)(buffer)

Returns a Promise<Buffer>.

options

Type: object

quality

Type: number

Compression quality, in range 0 (worst) to 100 (perfect).

progressive

Type: boolean
Default: true

false creates baseline JPEG file.

targa

Type: boolean
Default: false

Input file is Targa format (usually not needed).

revert

Type: boolean
Default: false

Revert to standard defaults instead of mozjpeg defaults.

fastCrush

Type: boolean
Default: false

Disable progressive scan optimization.

dcScanOpt

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
trellis

Type: boolean
Default: true

Trellis optimization.

trellisDC

Type: boolean
Default: true

Trellis optimization of DC coefficients.

tune

Type: string
Default: hvs-psnr

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

overshoot

Type: boolean
Default: true

Black-on-white deringing via overshoot.

arithmetic

Type: boolean
Default: false

Use arithmetic coding.

dct

Type: string
Default: int

Set DCT method:

  • int Use integer DCT
  • fast Use fast integer DCT (less accurate)
  • float Use floating-point DCT
quantBaseline

Type: boolean
Default: false

Use 8-bit quantization table entries for baseline JPEG compatibility.

quantTable

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
smooth

Type: number

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

maxMemory

Type: number

Set the maximum memory to use in kilobytes.

sample

Type: string[]

Set component sampling factors. Each item should be in the format HxV, for example 2x1.

buffer

Type: buffer

Buffer to optimize.

More Repositories

1

imagemin

Minify images seamlessly
JavaScript
5,562
star
2

imagemin-cli

Minify images seamlessly
JavaScript
923
star
3

imagemin-app

imagemin as an OS X, Linux and Windows app
JavaScript
826
star
4

imagemin-webp

WebP plugin for imagemin
JavaScript
496
star
5

imagemin-pngquant

Imagemin plugin for `pngquant`
JavaScript
316
star
6

imagemin-optipng

optipng plugin for imagemin
JavaScript
163
star
7

imagemin-svgo

SVGO plugin for imagemin
JavaScript
126
star
8

mozjpeg-bin

mozjpeg bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
120
star
9

imagemin-jpegtran

jpegtran plugin for imagemin
JavaScript
119
star
10

imagemin-gifsicle

Imagemin plugin for Gifsicle
JavaScript
116
star
11

pngquant-bin

pngquant bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
115
star
12

gifsicle-bin

gifsicle bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
113
star
13

optipng-bin

optipng bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
97
star
14

jpegtran-bin

jpegtran bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
93
star
15

cwebp-bin

cwebp bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
92
star
16

imagemin-guetzli

imagemin plugin for guetzli https://github.com/google/guetzli
JavaScript
81
star
17

imagemin-jpeg-recompress

jpeg-recompress imagemin plugin
JavaScript
63
star
18

imagemin-micro

Microservice for Imagemin
JavaScript
61
star
19

zopflipng-bin

zopflipng bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
51
star
20

pngcrush-bin

pngcrush bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
39
star
21

imagemin-jpegoptim

Imagemin plugin for jpegoptim
JavaScript
38
star
22

guetzli-bin

guetzli wrapper that makes it seamlessly available as a local dependency
JavaScript
30
star
23

imagemin-zopfli

zopfli plugin for imagemin
JavaScript
26
star
24

jpeg-recompress-bin

jpeg-recompress bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
25
star
25

jpegoptim-bin

jpegoptim bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
24
star
26

imagemin-pngcrush

pngcrush plugin for imagemin
JavaScript
23
star
27

imagemin-pngout

pngout plugin for imagemin
JavaScript
14
star
28

pngout-bin

pngout bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
14
star
29

imagemin-advpng

AdvPNG plugin for imagemin
JavaScript
9
star
30

advpng-bin

AdvPNG bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
8
star
31

logo

The imagemin logo
CSS
7
star
32

gif2webp-bin

gif2webp bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
7
star
33

imagemin-gif2webp

gif2webp plugin for imagemin
JavaScript
6
star
34

meta

General discussion repo for imagemin related projects
6
star
35

imagemin.io

The site for imagemin
CSS
4
star