imgo
Optimize image buffer
Last updated 2 years ago by 1000ch .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install imgo 
SYNC missed versions from official npm registry.

imgo

Optimize buffer of PNG, JPEG, GIF, SVG images.

Install

$ npm install imgo

Usage

JavaScript

const fs = require('fs');
const imgo = require('imgo');

fs.readFile('image.png', (error, data) => {
  imgo(data, {
    pngquant  : true,
    optipng   : true,
    zopflipng : true,
    pngcrush  : true
  }).then(optimized => {
    console.log('optimized image buffer', optimized);
  });
});

fs.readFile('image.jpg', (error, data) => {
  imgo(data, {
    jpegRecompress : true,
    jpegoptim      : true,
    mozjpeg        : true,
    guetzli        : true
  }).then(optimized => {
    console.log('optimized image buffer', optimized);
  });
});

fs.readFile('image.gif', (error, data) => {
  imgo(data, {
    gifsicle : true
  }).then(optimized => {
    console.log('optimized image buffer', optimized);
  });
});

fs.readFile('image.svg', (error, data) => {
  imgo(data, {
    svgo : true
  }).then(optimized => {
    console.log('optimized image buffer', optimized);
  });
});

CLI

# imgo help
$ imgo --help

# apply optipng and pngquant
$ cat image.png | imgo --optipng --pngquant > optimized.png

# apply all jpeg optimizers and out diff
$ cat image.jpg | imgo --jpg --info > optimized.jpg

# apply to jpeg files
$ imgo --jpg --info *.jpg

License

MIT: http://1000ch.mit-license.org

Current Tags

  • 4.0.0                                ...           latest (2 years ago)

34 Versions

  • 4.0.0                                ...           2 years ago
  • 3.5.1                                ...           3 years ago
  • 3.5.0                                ...           3 years ago
  • 3.4.0                                ...           4 years ago
  • 3.3.1                                ...           4 years ago
  • 3.3.0                                ...           4 years ago
  • 3.2.0                                ...           4 years ago
  • 3.1.0                                ...           4 years ago
  • 3.0.3                                ...           4 years ago
  • 3.0.2                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.0.4                                ...           5 years ago
  • 2.0.3                                ...           5 years ago
  • 2.0.2                                ...           5 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.0.5                                ...           5 years ago
  • 1.0.4                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.3.2                                ...           5 years ago
  • 0.3.1                                ...           5 years ago
  • 0.2.2                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.5                                ...           6 years ago
  • 0.1.4                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 34
Dependencies (22)
Dev Dependencies (2)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |