mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Allow use of 'tif' to select TIFF output (#2893)
This commit is contained in:
parent
481e350f39
commit
2679bb567b
@ -13,6 +13,7 @@ const formats = new Map([
|
|||||||
['png', 'png'],
|
['png', 'png'],
|
||||||
['raw', 'raw'],
|
['raw', 'raw'],
|
||||||
['tiff', 'tiff'],
|
['tiff', 'tiff'],
|
||||||
|
['tif', 'tiff'],
|
||||||
['webp', 'webp'],
|
['webp', 'webp'],
|
||||||
['gif', 'gif'],
|
['gif', 'gif'],
|
||||||
['jp2', 'jp2'],
|
['jp2', 'jp2'],
|
||||||
|
@ -298,6 +298,21 @@ describe('Input/output', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Support output to tif format', function (done) {
|
||||||
|
sharp(fixtures.inputTiff)
|
||||||
|
.resize(320, 240)
|
||||||
|
.toFormat('tif')
|
||||||
|
.toBuffer(function (err, data, info) {
|
||||||
|
if (err) throw err;
|
||||||
|
assert.strictEqual(true, data.length > 0);
|
||||||
|
assert.strictEqual(data.length, info.size);
|
||||||
|
assert.strictEqual('tiff', info.format);
|
||||||
|
assert.strictEqual(320, info.width);
|
||||||
|
assert.strictEqual(240, info.height);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('Fail when output File is input File', function (done) {
|
it('Fail when output File is input File', function (done) {
|
||||||
sharp(fixtures.inputJpg).toFile(fixtures.inputJpg, function (err) {
|
sharp(fixtures.inputJpg).toFile(fixtures.inputJpg, function (err) {
|
||||||
assert(err instanceof Error);
|
assert(err instanceof Error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user