mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Soften limitInputPixels upper limit #146
Default limit of 14-bit dimensions remains
This commit is contained in:
parent
ccb7887cb9
commit
ae968142ee
2
index.js
2
index.js
@ -442,7 +442,7 @@ Sharp.prototype.resize = function(width, height) {
|
|||||||
Assumes the image dimensions contained in the file header can be trusted
|
Assumes the image dimensions contained in the file header can be trusted
|
||||||
*/
|
*/
|
||||||
Sharp.prototype.limitInputPixels = function(limit) {
|
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;
|
this.options.limitInputPixels = limit;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid pixel limit (1 to ' + maximum.pixels + ') ' + limit);
|
throw new Error('Invalid pixel limit (1 to ' + maximum.pixels + ') ' + limit);
|
||||||
|
@ -665,16 +665,6 @@ describe('Input/output', function() {
|
|||||||
done();
|
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) {
|
it('Invalid fails - string', function(done) {
|
||||||
var isValid = false;
|
var isValid = false;
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user