Socket
Book a DemoInstallSign in
Socket

imagemin-guetzli

Package Overview
Dependencies
Maintainers
7
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imagemin-guetzli

Guetzli imagemin plugin

latest
Source
npmnpm
Version
3.0.0
Version published
Maintainers
7
Created
Source

imagemin-guetzli Build Status

Guetzli imagemin plugin

Guetzli is a JPEG encoder that aims for excellent compression density at high visual quality. Guetzli-generated images are typically 20-30% smaller than images of equivalent quality generated by libjpeg. Guetzli generates only sequential (nonprogressive) JPEGs due to faster decompression speeds they offer.

Install

$ npm install --save imagemin-guetzli

Usage

const imagemin = require('imagemin');
const imageminGuetzli = require('imagemin-guetzli');

imagemin(['images/*.{png,jpg}'], 'build/images', {
    use: [
        imageminGuetzli({quality: 95})
    ]
}).then(() => {
    console.log('Images optimized');
});

Usage (gulp-imagemin)

const gulp = require('gulp');
const imagemin = require('gulp-imagemin');
const imageminGuetzli = require('imagemin-guetzli');

gulp.task('default', () =>
    gulp.src('images/*')
        .pipe(imagemin([imageminGuetzli()]))
        .pipe(gulp.dest('dist/images'))
);

Notes

Guetzli uses a large amount of memory. You should provide 300MB of memory per 1MPix of the input image.

Guetzli uses a significant amount of CPU time. You should count on using about 1 minute of CPU per 1MPix of input image.

Guetzli assumes that input is in sRGB profile with a gamma of 2.2. Guetzli will ignore any color-profile metadata in the image.

Guetzli is designed to work on high quality images (e.g. that haven't been already compressed with other JPEG encoders). While it will work on other images too, results will be poorer. You can try compressing an enclosed sample high quality image.

Guetzli converts PNG/JPG to JPG. When using this plugin or guetzli-bin CLI, the original filename+ext is used as the output, although the image format has changed. You have to rename the file with the correct file extension (JPG) yourself afterwards.

API

imageminGuetzli([options])(buffer)

options

Type: object

quality

Type: number (0–100)
Default: 95

Set quality in units equivalent to libjpeg quality. As per guetzli function and purpose, it is not recommended to go below 84.

Please note that JPEG images do not support alpha channel (transparency). If the input is a PNG with an alpha channel, it will be overlaid on black background before encoding.

memlimit

Type: number
Default: 6000

Memory limit in MB. Guetzli will fail if unable to stay under the limit. Note: Currently, in imagemin-guetzli, this will fail silently as the error is not passed along.

nomemlimit

Type: boolean

Do not limit memory usage.

License

MIT © imagemin

Keywords

compress

FAQs

Package last updated on 30 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts