diff --git a/docs/src/content/docs/api-output.md b/docs/src/content/docs/api-output.md
index b6729c63..25ad70c6 100644
--- a/docs/src/content/docs/api-output.md
+++ b/docs/src/content/docs/api-output.md
@@ -717,7 +717,7 @@ instead of providing `xres` and `yres` in pixels/mm.
| [options.xres] | number | 1.0 | horizontal resolution in pixels/mm |
| [options.yres] | number | 1.0 | vertical resolution in pixels/mm |
| [options.resolutionUnit] | string | "'inch'" | resolution unit options: inch, cm |
-| [options.bitdepth] | number | 8 | reduce bitdepth to 1, 2 or 4 bit |
+| [options.bitdepth] | number | 0 | reduce bitdepth to 1, 2 or 4 bit |
| [options.miniswhite] | boolean | false | write 1-bit images as miniswhite |
**Example**
diff --git a/docs/src/content/docs/changelog/v0.35.0.md b/docs/src/content/docs/changelog/v0.35.0.md
index 9f97d0e3..69d954e8 100644
--- a/docs/src/content/docs/changelog/v0.35.0.md
+++ b/docs/src/content/docs/changelog/v0.35.0.md
@@ -20,6 +20,8 @@ slug: changelog/v0.35.0
* Upgrade to libvips v8.18.0 for upstream bug fixes.
+* Improve thread-safety of error (and warning) messages.
+
* Deprecate Windows 32-bit (win32-ia32) prebuilt binaries.
* Add AVIF/HEIF `tune` option for control over quality metrics.
diff --git a/lib/constructor.js b/lib/constructor.js
index 1a2e55be..149d0b34 100644
--- a/lib/constructor.js
+++ b/lib/constructor.js
@@ -366,7 +366,7 @@ const Sharp = function (input, options) {
tiffPredictor: 'horizontal',
tiffPyramid: false,
tiffMiniswhite: false,
- tiffBitdepth: 8,
+ tiffBitdepth: 0,
tiffTile: false,
tiffTileHeight: 256,
tiffTileWidth: 256,
diff --git a/lib/output.js b/lib/output.js
index d0e1d3d5..b0213f5e 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -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
diff --git a/src/common.cc b/src/common.cc
index bc608348..4b1f1c46 100644
--- a/src/common.cc
+++ b/src/common.cc
@@ -510,11 +510,11 @@ namespace sharp {
option = GetOptionsForImageType(imageType, descriptor);
image = VImage::new_from_buffer(descriptor->buffer, descriptor->bufferLength, nullptr, option);
}
- } catch (vips::VError const &err) {
- throw vips::VError(std::string("Input buffer has corrupt header: ") + err.what());
+ } catch (std::runtime_error const &err) {
+ throw std::runtime_error(std::string("Input buffer has corrupt header: ") + err.what());
}
} else {
- throw vips::VError("Input buffer contains unsupported image format");
+ throw std::runtime_error("Input buffer contains unsupported image format");
}
}
} else {
@@ -585,10 +585,10 @@ namespace sharp {
imageType = DetermineImageType(descriptor->file.data());
if (imageType == ImageType::MISSING) {
if (descriptor->file.find("