Ability to disable limitInputPixels #250

Update docs
Added a giant image for testing
Adding myself to contributors
Added tests to verify giant image can be opened
Extend test-win time limit (because of large images)
This commit is contained in:
kentongray
2016-04-04 02:35:11 -05:00
committed by Lovell Fuller
parent b2d7d4c4a9
commit 8c9c070caf
7 changed files with 35 additions and 6 deletions

BIN
test/fixtures/giant-image.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@@ -79,6 +79,7 @@ module.exports = {
inputPngOverlayLayer2LowAlpha: getPath('alpha-layer-2-ink-low-alpha.png'),
inputPngAlphaPremultiplicationSmall: getPath('alpha-premultiply-1024x768-paper.png'),
inputPngAlphaPremultiplicationLarge: getPath('alpha-premultiply-2048x1536-paper.png'),
inputPngLarge: getPath('giant-image.png'),
inputWebP: getPath('4.webp'), // http://www.gstatic.com/webp/gallery/4.webp
inputWebPWithTransparency: getPath('5_webp_a.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp

View File

@@ -876,6 +876,24 @@ describe('Input/output', function() {
});
});
it('Disabling limit works', function(done) {
sharp(fixtures.inputPngLarge)
.limitInputPixels(false)
.toBuffer(function(err) {
assert.strictEqual(true, !err);
done();
});
});
it('Enabling default limit fails works and fails with a large image', function(done) {
sharp(fixtures.inputPngLarge)
.limitInputPixels(true)
.toBuffer(function(err) {
assert.strictEqual(true, !!err);
done();
});
});
it('Smaller than input fails', function(done) {
sharp(fixtures.inputJpg).metadata(function(err, metadata) {
if (err) throw err;