Add alpha channels, if missing, to overlayWith images (#540)

This commit is contained in:
cmtt
2016-08-13 18:19:15 +02:00
committed by Lovell Fuller
parent 82ec2715f1
commit fc2002fbd0
3 changed files with 28 additions and 4 deletions

View File

@@ -154,11 +154,20 @@ describe('Overlays', function() {
});
}
it('Fail when overlay does not contain alpha channel', function(done) {
it('Composite JPEG onto PNG', function(done) {
sharp(fixtures.inputPngOverlayLayer1)
.overlayWith(fixtures.inputJpg)
.overlayWith(fixtures.inputJpgWithLandscapeExif1)
.toBuffer(function(error) {
assert.strictEqual(true, error instanceof Error);
if (error) return done(error);
done();
});
});
it('Composite opaque JPEG onto JPEG', function(done) {
sharp(fixtures.inputJpg)
.overlayWith(fixtures.inputJpgWithLandscapeExif1)
.toBuffer(function(error) {
if (error) return done(error);
done();
});
});