sylph

Image processing service

Sylph

v0.0.2 Image optimization, processing, and spriting library.

 
var fs = require('fs'),
    Sylph = require('sylph');
 
var sylph = new Sylph();
 
var imagePath = './resources/image.jpg',
    image = fs.readFileSync(imagePath);
 
// let's scale an image to 200x200 and then optimize it 
 
sylph.features(image, function(errfeatures){
  sylph.scale(image, { height: 200 }, function(errimage) {
    sylph.smush(image, features.format, function(errimage){
      fs.writeFile(imagePath.replace(/jpg/, 'min.jpg'), image);
    });
  });
});
 
  • Optimize images
  • Build requested image sizes
  • Build sprite sheet (image1&image2) [planned]
  • Imagemagick
  • jpegtran (can be installed through npm)

OSX: brew install imagemagick pngcrush

Debians: sudo apt-get install imagemagick pngcrush