Switch default interpolator to bicubic #289
Only use gaussian blur for non-linear interpolators Improves performance of bilinear by ~15% Add liborc to the packaged build to improve bicubic perf Add examples of the various interpolation methods Add bilinear vs bicubic to perf tests
979
test/bench/perf.js
Executable file → Normal file
BIN
test/fixtures/expected/extract-resize.jpg
vendored
|
Before Width: | Height: | Size: 506 B After Width: | Height: | Size: 519 B |
BIN
test/fixtures/expected/gamma-0.0.jpg
vendored
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 1.7 KiB |
48
test/interpolators/README.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# Interpolators
|
||||
|
||||
[Photo](https://www.flickr.com/photos/aotaro/21978966091) by
|
||||
[aotaro](https://www.flickr.com/photos/aotaro/) is licensed under
|
||||
[CC BY 2.0](https://creativecommons.org/licenses/by/2.0/).
|
||||
|
||||
The following examples take the 4608x3072px original image
|
||||
and resize to 480x320px using various interpolators.
|
||||
|
||||
To fetch the original 4608x3072px image and
|
||||
generate the interpolator sample images:
|
||||
|
||||
```sh
|
||||
curl -O https://farm6.staticflickr.com/5682/21978966091_b421afe866_o.jpg
|
||||
node generate.js
|
||||
```
|
||||
|
||||
## Nearest neighbour
|
||||
|
||||

|
||||
|
||||
## Bilinear
|
||||
|
||||

|
||||
|
||||
## Bicubic
|
||||
|
||||

|
||||
|
||||
## Locally bounded bicubic
|
||||
|
||||

|
||||
|
||||
## Vertex-split quadratic b-splines (VSQBS)
|
||||
|
||||

|
||||
|
||||
## Nohalo
|
||||
|
||||

|
||||
|
||||
## GraphicsMagick
|
||||
|
||||

|
||||
|
||||
```sh
|
||||
gm convert 21978966091_b421afe866_o.jpg -resize 480x320^ -gravity center -extent 480x320 -quality 95 -strip -define jpeg:optimize-coding=true gm.jpg
|
||||
```
|
||||
BIN
test/interpolators/bicubic.jpg
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
test/interpolators/bilinear.jpg
Normal file
|
After Width: | Height: | Size: 61 KiB |
11
test/interpolators/generate.js
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
['nearest', 'bilinear', 'bicubic', 'vsqbs', 'lbb', 'nohalo'].forEach(function(interpolator) {
|
||||
require('../../')('21978966091_b421afe866_o.jpg')
|
||||
.resize(480, 320)
|
||||
.interpolateWith(interpolator)
|
||||
.quality(95)
|
||||
.toFile(interpolator + '.jpg', function(err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
BIN
test/interpolators/gm.jpg
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
test/interpolators/lbb.jpg
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
test/interpolators/nearest.jpg
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
test/interpolators/nohalo.jpg
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
test/interpolators/vsqbs.jpg
Normal file
|
After Width: | Height: | Size: 58 KiB |
2
test/unit/gamma.js
Executable file → Normal file
@@ -16,7 +16,7 @@ describe('Gamma correction', function() {
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(129, info.width);
|
||||
assert.strictEqual(111, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('gamma-0.0.jpg'), data, {threshold: 12}, done);
|
||||
fixtures.assertSimilar(fixtures.expected('gamma-0.0.jpg'), data, done);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||