From here on in, this module will be using the bleeding edge version of libvips. Why? It just keeps getting faster.

This commit is contained in:
Lovell Fuller 2013-11-23 22:08:51 +00:00
parent 21f12e74ba
commit dde9e94850
4 changed files with 9 additions and 14 deletions

View File

@ -19,16 +19,11 @@ Performance is 4x-8x faster than ImageMagick and 2x-4x faster than GraphicsMagic
* Node.js v0.8+
* node-gyp
* libvips-dev 7.28+ (7.36+ for optimal JPEG Huffman coding)
* [libvips](https://github.com/jcupitt/libvips) v7.37+
```
sudo npm install -g node-gyp
sudo apt-get install libvips-dev
```
For the sharpest results, please compile libvips from source.
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
If you prefer to run a stable, package-managed environment such as Ubuntu 12.04 LTS, [v0.0.3](https://github.com/lovell/sharp/tree/v0.0.3) will work with the libvips-dev package.
## Install
@ -84,7 +79,6 @@ sharp.embedBlack("input.png", "output.png", 200, 300, function(err) {
## Testing
npm install --dev sharp
npm test
## Performance

View File

@ -1,6 +1,6 @@
{
"name": "sharp",
"version": "0.0.5",
"version": "0.0.6",
"author": "Lovell Fuller",
"description": "High performance module to resize JPEG and PNG images using the libvips image processing library",
"scripts": {

View File

@ -126,12 +126,12 @@ void ResizeAsync(uv_work_t *work) {
img = t[3];
if (EndsWith(baton->dst, ".jpg") || EndsWith(baton->dst, ".jpeg")) {
if (vips_jpegsave(img, baton->dst.c_str(), "Q", 80, "profile", "none", "optimize_coding", TRUE, NULL)) {
if (vips_foreign_save(img, baton->dst.c_str(), "strip", TRUE, "Q", 80, "optimize_coding", TRUE, NULL)) {
(baton->err).append(vips_error_buffer());
vips_error_clear();
}
} else if (EndsWith(baton->dst, ".png")) {
if (vips_pngsave(img, baton->dst.c_str(), "compression", 6, "interlace", FALSE, NULL)) {
if (vips_foreign_save(img, baton->dst.c_str(), "strip", TRUE, "compression", 6, "interlace", FALSE, NULL)) {
(baton->err).append(vips_error_buffer());
vips_error_clear();
}

View File

@ -115,7 +115,8 @@ async.series({
}).run();
}
}, function(err, results) {
results.forEach(function(format, fastest) {
assert(fastest === "sharp", "sharp was slower than " + fastest + " for " + format);
assert(!err, err);
Object.keys(results).forEach(function(format) {
assert(results[format] == "sharp", "sharp was slower than " + results[format] + " for " + format);
});
});