Browse Source

Add largeImageThreshold option to control when to skip pixels

pull/22/head
Martin Laine 10 years ago
parent
commit
2d11034368
  1. 9
      README.md
  2. 10
      resemble.js

9
README.md

@ -63,11 +63,16 @@ resemble.outputSettings({
blue: 255
},
errorType: 'movement',
transparency: 0.3
transparency: 0.3,
largeImageThreshold: 1200
});
// resembleControl.repaint();
```
By default, the comparison algorithm skips pixels when the image width or height is larger than 1200 pixels. This is there to mitigate performance issues.
You can switch this modify this behaviour by setting the `largeImageThreshold` option to a different value. Set it to **0** to switch it off completely.
--------------------------------------
Created by [James Cryer](http://github.com/jamescryer) and the Huddle development team.
Created by [James Cryer](http://github.com/jamescryer) and the Huddle development team.

10
resemble.js

@ -33,9 +33,11 @@ URL: https://github.com/Huddle/Resemble.js
}
}
};
var errorPixelTransformer = errorPixelTransform.flat;
var largeImageThreshold = 1200;
_this['resemble'] = function( fileData ){
var data = {};
@ -347,7 +349,7 @@ URL: https://github.com/Huddle/Resemble.js
var skip;
if( (width > 1200 || height > 1200) && ignoreAntialiasing){
if(!!largeImageThreshold && ignoreAntialiasing && (width > largeImageThreshold || height > largeImageThreshold)){
skip = 6;
}
@ -592,9 +594,11 @@ URL: https://github.com/Huddle/Resemble.js
if(options.errorType && errorPixelTransform[options.errorType] ){
errorPixelTransformer = errorPixelTransform[options.errorType];
}
pixelTransparency = options.transparency || pixelTransparency;
largeImageThreshold = options.largeImageThreshold || largeImageThreshold;
return this;
};

Loading…
Cancel
Save