Node bindings for the Epeg library
C C++ JavaScript Python
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
README.md
binding.gyp
index.js
package.json

README.md

Install:

npm install epeg

Downsize:

var epeg = require("epeg");

image = new epeg.Image({path: "./test.jpg"}))
image.downsize(100, 100).saveTo("./output.jpg");

Crop:

var epeg = require("epeg");

image = new epeg.Image({path: "./test.jpg"}))
image.crop(200, 200, 100, 100).saveTo("./output.jpg");

Both can take an optional 'quality' parameter between 1 and 100 (default is 85):

var epeg = require("epeg");

image = new epeg.Image({path: "./test.jpg"}))
image.downsize(100, 100, 50).saveTo("./ugly.jpg");

You can also use buffers as I/O:

var fs = require("fs");
var epeg = require("epeg");

fs.readFile("./test.jpg", function(err, data) {
  var image = new epeg.Image({data: data});
  buffer = image.downsize(100, 100).process();
  fs.writeFileSync("./output.jpg", buffer);
}