Skip to content

jpegtran (part of libjpeg-turbo) Node.js wrapper that makes it seamlessly available as a local dependency on OS X, Linux, FreeBSD, Solaris, and Windows. Most commonly used to losslessly minify JPEG images.

Notifications You must be signed in to change notification settings

kthu/node-jpegtran-bin

 
 

Repository files navigation

node-jpegtran-bin Build Status

jpegtran 1.3 (part of libjpeg-turbo) Node.js wrapper that makes it seamlessly available as a local dependency on OS X, Linux, FreeBSD, Solaris and Windows. Most commonly used to losslessly minify JPEG images.

libjpeg-turbo is a derivative of libjpeg that uses SIMD instructions (MMX, SSE2, NEON) to accelerate baseline JPEG compression and decompression on x86, x86-64, and ARM systems. On such systems, libjpeg-turbo is generally 2-4x as fast as the unmodified version of libjpeg, all else being equal.

Install

  • Install with npm: npm install --save jpegtran-bin

Example usage

var execFile = require('child_process').execFile;
var jpegtranPath = require('jpegtran-bin').path;

execFile(jpegtranPath, ['-outfile', 'output.jpg', 'input.jpg'], function() {
    console.log('Image minified');
});

Can also be run directly from ./node_modules/.bin/jpegtran.

Dev

Note to self on how to update the binaries.

OS X and Linux

  • Run npm install to build the binary.

The nasm (Netwide Assember) package is required to build the binary on Ubuntu.

Windows

  • Download the Windows files 32/64-bit (GCC compiled) on a Windows machine
  • Run the downloaded file to extract
  • Go to the bin folder at the destination and copy jpegtran.exe and libjpeg-62.dll

License

Everything excluding the binaries licensed under the BSD license and copyright Google.

libjpeg-turbo licensed under the BSD license and copyright dcommander.

About

jpegtran (part of libjpeg-turbo) Node.js wrapper that makes it seamlessly available as a local dependency on OS X, Linux, FreeBSD, Solaris, and Windows. Most commonly used to losslessly minify JPEG images.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%