Compare commits

...

6 Commits

Author SHA1 Message Date
Lovell Fuller
daeebcc7dc Add epeg module to the perf tests 2013-10-19 13:39:57 +01:00
Lovell Fuller
5546a4f881 Added GraphicsMagick perf stats 2013-10-04 22:01:16 +01:00
Lovell Fuller
4aee725530 README layout clean-up 2013-10-02 23:40:32 +01:00
Lovell Fuller
f3da2284b1 Now requires livbips 7.28 or later 2013-10-02 23:37:29 +01:00
Lovell Fuller
f3cd263cb7 Replaced use of deprecated libvips im_* methods with new, shiny non-deprecated vips_* versions 2013-10-02 21:50:03 +01:00
Lovell Fuller
8443dd5122 Version bump 2013-10-02 19:35:49 +01:00
4 changed files with 40 additions and 18 deletions

View File

@@ -13,22 +13,20 @@ It is somewhat opinionated in that it only deals with JPEG images, always obeys
Under the hood you'll find the blazingly fast [libvips](https://github.com/jcupitt/libvips) image processing library, originally created in 1989 at Birkbeck College and currently maintained by the University of Southampton.
Performance is 4x-8x faster than the imagemagick equivalent, based mainly on the number of CPU cores available.
Performance is 4x-8x faster than ImageMagick and 2x-4x faster than GraphicsMagick, based mainly on the number of CPU cores available.
## Prerequisites
Requires Node.js v0.8+, node-gyp and libvips-dev to build.
* Node.js v0.8+
* node-gyp
* libvips-dev 7.28+
sudo npm install -g node-gyp
sudo apt-get install libvips-dev
```
sudo npm install -g node-gyp
sudo apt-get install libvips-dev
```
Requires vips-7.xx.pc (installed with libvips-dev) to be symlinked as /usr/lib/pkgconfig/vips.pc
Ubuntu 12.04 LTS:
sudo ln -s /usr/lib/pkgconfig/vips-7.26.pc /usr/lib/pkgconfig/vips.pc
Ubuntu 13.04 (64-bit):
When installed as a package, please symlink `vips-7.28.pc` (or later, installed with libvips-dev) as `/usr/lib/pkgconfig/vips.pc`. To do this in Ubuntu 13.04 (64-bit), use:
sudo ln -s /usr/lib/x86_64-linux-gnu/pkgconfig/vips-7.28.pc /usr/lib/pkgconfig/vips.pc
@@ -84,7 +82,7 @@ sharp.embedBlack("input.jpg", "output.jpg", 200, 300, function(err) {
});
```
## Testing [![Build Status](https://travis-ci.org/lovell/sharp.png?branch=master)](https://travis-ci.org/lovell/sharp)
## Testing
npm install --dev sharp
npm test
@@ -93,8 +91,10 @@ sharp.embedBlack("input.jpg", "output.jpg", 200, 300, function(err) {
### AMD Athlon 4x core 3.3GHz 512KB L2
* imagemagick x 5.55 ops/sec ±0.68% (31 runs sampled)
* sharp x 24.49 ops/sec ±6.85% (64 runs sampled)
* imagemagick x 5.55 ops/sec ±0.45% (31 runs sampled)
* gm x 10.31 ops/sec ±3.57% (53 runs sampled)
* epeg x 27.79 ops/sec ±0.12% (69 runs sampled)
* sharp x 31.52 ops/sec ±8.74% (80 runs sampled)
### AWS t1.micro

View File

@@ -1,6 +1,6 @@
{
"name": "sharp",
"version": "0.0.3",
"version": "0.0.4",
"main": "index.js",
"description": "High performance Node.js module to resize JPEG images using the libvips image processing library",
"repository": {
@@ -9,6 +9,8 @@
},
"devDependencies": {
"imagemagick": "*",
"gm": "*",
"epeg": "*",
"benchmark": "*"
},
"scripts": {

View File

@@ -39,7 +39,7 @@ void ResizeAsync(uv_work_t *work) {
ResizeBaton* baton = static_cast<ResizeBaton*>(work->data);
VipsImage *in = vips_image_new_mode((baton->src).c_str(), "p");
im_jpeg2vips((baton->src).c_str(), in);
vips_jpegload((baton->src).c_str(), &in, NULL);
if (in == NULL) {
(baton->err).append(vips_error_buffer());
vips_error_clear();
@@ -114,10 +114,10 @@ void ResizeAsync(uv_work_t *work) {
}
img = t[3];
if (im_vips2jpeg(img, baton->dst.c_str())) {
if (vips_jpegsave(img, baton->dst.c_str(), "Q", 80, "profile", "none", "optimize_coding", TRUE, NULL)) {
(baton->err).append(vips_error_buffer());
vips_error_clear();
}
}
}
void ResizeAsyncAfter(uv_work_t *work, int status) {

View File

@@ -1,5 +1,7 @@
var sharp = require("../index");
var imagemagick = require("imagemagick");
var gm = require("gm");
var epeg = require("epeg");
var assert = require("assert");
var Benchmark = require("benchmark");
@@ -26,6 +28,24 @@ suite.add("imagemagick", {
}
});
}
}).add("gm", {
"defer": true,
"fn": function(deferred) {
gm(input).crop(width, height).write(output, function (err) {
if (err) {
throw err;
} else {
deferred.resolve();
}
});
}
}).add("epeg", {
"defer": true,
"fn": function(deferred) {
var image = new epeg.Image({path: input});
image.downsize(width, height).saveTo(output);
deferred.resolve();
}
}).add("sharp", {
"defer": true,
"fn": function(deferred) {