mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 15:25:07 +01:00
Add background option to tile output operation (#1924)
This commit is contained in:
committed by
Lovell Fuller
parent
d82a6ee4fc
commit
08a6597626
@@ -213,6 +213,7 @@ const Sharp = function (input, options) {
|
||||
tileSize: 256,
|
||||
tileOverlap: 0,
|
||||
tileSkipBlanks: -1,
|
||||
tileBackground: [255, 255, 255, 255],
|
||||
linearA: 1,
|
||||
linearB: 0,
|
||||
// Function to notify of libvips warnings
|
||||
|
||||
@@ -551,6 +551,7 @@ function toFormat (format, options) {
|
||||
* @param {Number} [options.size=256] tile size in pixels, a value between 1 and 8192.
|
||||
* @param {Number} [options.overlap=0] tile overlap in pixels, a value between 0 and 8192.
|
||||
* @param {Number} [options.angle=0] tile angle of rotation, must be a multiple of 90.
|
||||
* @param {String|Object} [options.background={r: 255, g: 255, b: 255, alpha: 1}] - background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to white without transparency.
|
||||
* @param {String} [options.depth] how deep to make the pyramid, possible values are `onepixel`, `onetile` or `one`, default based on layout.
|
||||
* @param {Number} [options.skipBlanks=-1] threshold to skip tile generation, a value 0 - 255 for 8-bit images or 0 - 65535 for 16-bit images
|
||||
* @param {String} [options.container='fs'] tile container, with value `fs` (filesystem) or `zip` (compressed file).
|
||||
@@ -603,6 +604,8 @@ function tile (options) {
|
||||
throw is.invalidParameterError('angle', 'positive/negative multiple of 90', options.angle);
|
||||
}
|
||||
}
|
||||
// Background colour
|
||||
this._setBackgroundColourOption('tileBackground', options.background);
|
||||
// Depth of tiles
|
||||
if (is.defined(options.depth)) {
|
||||
if (is.string(options.depth) && is.inArray(options.depth, ['onepixel', 'onetile', 'one'])) {
|
||||
|
||||
Reference in New Issue
Block a user