mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Add ability to read and write native vips .v files (#500)
This commit is contained in:
committed by
Lovell Fuller
parent
b69627891d
commit
f672f86b53
BIN
test/fixtures/expected/vfile.jpg
vendored
Normal file
BIN
test/fixtures/expected/vfile.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
3
test/fixtures/index.js
vendored
3
test/fixtures/index.js
vendored
@@ -95,9 +95,12 @@ module.exports = {
|
||||
inputPngStripesV: getPath('stripesV.png'),
|
||||
inputPngStripesH: getPath('stripesH.png'),
|
||||
|
||||
inputV: getPath('vfile.v'),
|
||||
|
||||
outputJpg: getPath('output.jpg'),
|
||||
outputPng: getPath('output.png'),
|
||||
outputWebP: getPath('output.webp'),
|
||||
outputV: getPath('output.v'),
|
||||
outputZoinks: getPath('output.zoinks'), // an 'unknown' file extension
|
||||
|
||||
// Path for tests requiring human inspection
|
||||
|
||||
BIN
test/fixtures/vfile.v
vendored
Normal file
BIN
test/fixtures/vfile.v
vendored
Normal file
Binary file not shown.
@@ -781,6 +781,37 @@ describe('Input/output', function() {
|
||||
});
|
||||
}
|
||||
|
||||
if (sharp.format.v.input.file) {
|
||||
it("Load Vips V file", function(done) {
|
||||
sharp(fixtures.inputV)
|
||||
.jpeg()
|
||||
.toBuffer(function(err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(70, info.width);
|
||||
assert.strictEqual(60, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('vfile.jpg'), data, done);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (sharp.format.v.output.file) {
|
||||
it("Save Vips V file", function(done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.extract({left: 910, top: 1105, width: 70, height: 60})
|
||||
.toFile(fixtures.outputV, function(err, info) {
|
||||
if(err) throw err;
|
||||
assert.strictEqual(true, info.size > 0);
|
||||
assert.strictEqual('v', info.format);
|
||||
assert.strictEqual(70, info.width);
|
||||
assert.strictEqual(60, info.height);
|
||||
fs.unlinkSync(fixtures.outputV);
|
||||
done();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (sharp.format.raw.output.buffer) {
|
||||
describe('Ouput raw, uncompressed image data', function() {
|
||||
it('1 channel greyscale image', function(done) {
|
||||
|
||||
Reference in New Issue
Block a user