Add alpha channel, if required, before extend operation (#439)

This commit is contained in:
frulo
2016-05-26 10:46:14 +02:00
committed by Lovell Fuller
parent 331926dc3c
commit e699e36270
3 changed files with 20 additions and 1 deletions

View File

@@ -49,4 +49,16 @@ describe('Extend', function () {
});
});
it('should add alpha channel before extending with a transparent Background', function( done ){
sharp(fixtures.inputJpgWithLandscapeExif1)
.background({r: 0, g: 0, b: 0, a: 0})
.toFormat( sharp.format.png )
.extend({top: 0, bottom: 10, left: 0, right: 10})
.toBuffer( function(err, data, info){
assert.strictEqual(610, info.width);
assert.strictEqual(460, info.height);
fixtures.assertSimilar(fixtures.expected('addAlphaChanelBeforeExtend.png'), data, done);
});
});
});