jpeg-recompress-bin

Jpeg-recompress wrapper that makes it seamlessly available as a local dependency on OS X, Linux, Windows.

npm install jpeg-recompress-bin
4 downloads in the last day
47 downloads in the last week
172 downloads in the last month

node-jpeg-recompress-bin

About

jpeg-recompress (part of JPEG Archive) Node.js wrapper that optimize JPEG images.

Compress JPEGs by re-encoding to the smallest JPEG quality while keeping perceived visual quality the same and by making sure huffman tables are optimized. This is a lossy operation, but the images are visually identical and it usually saves 30-70% of the size for JPEGs coming from a digital camera, particularly DSLRs. By default all EXIF/IPTC/XMP and color profile metadata is copied over, but this can be disabled to save more space if desired.

Build Status NPM version Dependency Status devDependency Status

NPM

Dependency

It requires libjpeg (or libjpeg-turbo is recommended).

Ubuntu

$ sudo apt-get install build-essential libjpeg-turbo8 libjpeg-turbo8-dev

Mac OS X

$ brew install libjpeg

Install

$ npm install -g jpeg-recompress-bin

Usage with Node.js

var execFile = require('child_process').execFile;
var jpegRecompressPath = require('jpeg-recompress-bin').path;

execFile(jpegRecompressPath, ['--quality high', '--min 60', 'input.jpg', 'output.jpg'], function() {
  console.log('Image minified');
});

License

This is MIT. JPEG Archive is also licensed under MIT.

npm loves you