Add support for loading images through ImageMagick as a buffer

This commit is contained in:
Maurus Cuelenaere
2015-02-15 16:14:46 +01:00
parent 1f7e80e581
commit ab7408c96f
3 changed files with 37 additions and 2 deletions

View File

@@ -537,6 +537,24 @@ describe('Input/output', function() {
});
}
if (semver.gte(sharp.libvipsVersion(), '8.0.0')) {
it('Load GIF from Buffer [libvips ' + sharp.libvipsVersion() + '>=8.0.0]', function(done) {
var inputGifBuffer = fs.readFileSync(fixtures.inputGif);
sharp(inputGifBuffer)
.resize(320, 240)
.jpeg()
.toBuffer(function(err, data, info) {
if (err) throw err;
assert.strictEqual(true, data.length > 0);
assert.strictEqual(data.length, info.size);
assert.strictEqual('jpeg', info.format);
assert.strictEqual(320, info.width);
assert.strictEqual(240, info.height);
done();
});
});
}
if (semver.gte(sharp.libvipsVersion(), '7.42.0')) {
describe('Ouput raw, uncompressed image data [libvips ' + sharp.libvipsVersion() + '>=7.42.0]', function() {
it('1 channel greyscale image', function(done) {