Skip to content

Commit

Permalink
Soften limitInputPixels upper limit #146
Browse files Browse the repository at this point in the history
Default limit of 14-bit dimensions remains
  • Loading branch information
lovell committed Apr 12, 2015
1 parent ccb7887 commit ae96814
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ Sharp.prototype.resize = function(width, height) {
Assumes the image dimensions contained in the file header can be trusted
*/
Sharp.prototype.limitInputPixels = function(limit) {
if (typeof limit === 'number' && !Number.isNaN(limit) && limit % 1 === 0 && limit > 0 && limit <= maximum.pixels) {
if (typeof limit === 'number' && !Number.isNaN(limit) && limit % 1 === 0 && limit > 0) {
this.options.limitInputPixels = limit;
} else {
throw new Error('Invalid pixel limit (1 to ' + maximum.pixels + ') ' + limit);
Expand Down
10 changes: 0 additions & 10 deletions test/unit/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,16 +665,6 @@ describe('Input/output', function() {
done();
});

it('Invalid fails - huge', function(done) {
var isValid = false;
try {
sharp().limitInputPixels(Math.pow(0x3FFF, 2) + 1);
isValid = true;
} catch (e) {}
assert(!isValid);
done();
});

it('Invalid fails - string', function(done) {
var isValid = false;
try {
Expand Down

0 comments on commit ae96814

Please sign in to comment.