mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 15:25:07 +01:00
Expose libvips centre option, mimics *magick +0.5px convention
This commit is contained in:
@@ -94,6 +94,8 @@ const interpolator = {
|
||||
* @param {Object} [options]
|
||||
* @param {String} [options.kernel='lanczos3'] - the kernel to use for image reduction.
|
||||
* @param {String} [options.interpolator='bicubic'] - the interpolator to use for image enlargement.
|
||||
* @param {Boolean} [options.centreSampling=false] - use *magick centre sampling convention instead of corner sampling.
|
||||
* @param {Boolean} [options.centerSampling=false] - alternative spelling of centreSampling.
|
||||
* @returns {Sharp}
|
||||
* @throws {Error} Invalid parameters
|
||||
*/
|
||||
@@ -133,6 +135,11 @@ const resize = function resize (width, height, options) {
|
||||
throw new Error('Invalid interpolator ' + options.interpolator);
|
||||
}
|
||||
}
|
||||
// Centre sampling
|
||||
options.centreSampling = is.bool(options.centerSampling) ? options.centerSampling : options.centreSampling;
|
||||
if (is.defined(options.centreSampling)) {
|
||||
this._setBooleanOption('centreSampling', options.centreSampling);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user