mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Improve multi-frame image resizing (#2789)
* Ports vips_thumbnail logic to sharp * Deprecates the pageHeight output option for WebP/GIF
This commit is contained in:
committed by
GitHub
parent
659cdabd8e
commit
513fb40f40
@@ -6,16 +6,30 @@ const sharp = require('../../');
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
describe('Extend', function () {
|
||||
it('extend all sides equally via a single value', function (done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(120)
|
||||
.extend(10)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(140, info.width);
|
||||
assert.strictEqual(118, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('extend-equal-single.jpg'), data, done);
|
||||
});
|
||||
describe('extend all sides equally via a single value', function () {
|
||||
it('JPEG', function (done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(120)
|
||||
.extend(10)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(140, info.width);
|
||||
assert.strictEqual(118, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('extend-equal-single.jpg'), data, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('Animated WebP', function (done) {
|
||||
sharp(fixtures.inputWebPAnimated, { pages: -1 })
|
||||
.resize(120)
|
||||
.extend(10)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(140, info.width);
|
||||
assert.strictEqual(140 * 9, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('extend-equal-single.webp'), data, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('extend all sides equally with RGB', function (done) {
|
||||
|
||||
Reference in New Issue
Block a user