mirror of
https://github.com/lovell/sharp.git
synced 2026-02-06 06:36:17 +01:00
Ensure TIFF output bitdepth option is limited to 1, 2 or 4
This commit is contained in:
@@ -1055,7 +1055,7 @@ function trySetAnimationOptions (source, target) {
|
||||
* @param {number} [options.xres=1.0] - horizontal resolution in pixels/mm
|
||||
* @param {number} [options.yres=1.0] - vertical resolution in pixels/mm
|
||||
* @param {string} [options.resolutionUnit='inch'] - resolution unit options: inch, cm
|
||||
* @param {number} [options.bitdepth=8] - reduce bitdepth to 1, 2 or 4 bit
|
||||
* @param {number} [options.bitdepth=0] - reduce bitdepth to 1, 2 or 4 bit
|
||||
* @param {boolean} [options.miniswhite=false] - write 1-bit images as miniswhite
|
||||
* @returns {Sharp}
|
||||
* @throws {Error} Invalid options
|
||||
@@ -1070,10 +1070,10 @@ function tiff (options) {
|
||||
}
|
||||
}
|
||||
if (is.defined(options.bitdepth)) {
|
||||
if (is.integer(options.bitdepth) && is.inArray(options.bitdepth, [1, 2, 4, 8])) {
|
||||
if (is.integer(options.bitdepth) && is.inArray(options.bitdepth, [1, 2, 4])) {
|
||||
this.options.tiffBitdepth = options.bitdepth;
|
||||
} else {
|
||||
throw is.invalidParameterError('bitdepth', '1, 2, 4 or 8', options.bitdepth);
|
||||
throw is.invalidParameterError('bitdepth', '1, 2 or 4', options.bitdepth);
|
||||
}
|
||||
}
|
||||
// tiling
|
||||
|
||||
Reference in New Issue
Block a user