diff --git a/.cirrus.yml b/.cirrus.yml
index e59b4b9f9..5a6fb8c59 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,15 +1,18 @@
freebsd_instance:
- image_family: freebsd-13-0-snap
+ image_family: freebsd-16-0-snap
task:
- name: FreeBSD 13.0
+ name: FreeBSD
env:
IGNORE_OSVERSION: yes
+ skip_notifications: true
prerequisites_script:
- pkg update -f
- pkg upgrade -y
- - pkg install -y pkgconf vips node npm
+ - pkg install -y devel/git devel/pkgconf graphics/vips www/node22 www/npm
+ - pkg-config --modversion vips-cpp
install_script:
- - npm install --build-from-source --unsafe-perm
+ - npm install
+ - npm run build
test_script:
- - npm test
+ - node --test test/unit/io.js
diff --git a/.editorconfig b/.editorconfig
index 5760be583..62fb51fed 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -7,6 +7,4 @@ indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
-
-[*.md]
-trim_trailing_whitespace = false
+max_line_length = 120
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 57bc2fef0..000000000
--- a/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-src/libvips/* linguist-vendored
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 0853a4adf..b65d48b98 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -6,8 +6,6 @@ Hello, thank you for your interest in helping!
Please create a [new issue](https://github.com/lovell/sharp/issues/new) containing the steps to reproduce the problem.
-If you're having installation problems, please include the output of running `npm install --verbose sharp`.
-
New bugs are assigned a `triage` label whilst under investigation.
## Submit a new feature request
@@ -16,29 +14,29 @@ If a [similar request](https://github.com/lovell/sharp/labels/enhancement) exist
it's probably fastest to add a comment to it about your requirement.
Implementation is usually straightforward if libvips
-[already supports](https://libvips.github.io/libvips/API/current/func-list.html)
+[already supports](https://www.libvips.org/API/current/function-list.html)
the feature you need.
## Submit a Pull Request to fix a bug
Thank you! To prevent the problem occurring again, please add unit tests that would have failed.
-Please select the `master` branch as the destination for your Pull Request so your fix can be included in the next minor release.
+Please select the `main` branch as the destination for your Pull Request so your fix can be included in the next minor release.
-Please squash your changes into a single commit using a command like `git rebase -i upstream/master`.
+Please squash your changes into a single commit using a command like `git rebase -i upstream/main`.
-To test C++ changes, you can compile the module using `npm install --build-from-source` and then run the tests using `npm test`.
+To test C++ changes, you can compile the module using `npm run build` and then run the tests using `npm test`.
## Submit a Pull Request with a new feature
-Please add JavaScript [unit tests](https://github.com/lovell/sharp/tree/master/test/unit) to cover your new feature.
-A test coverage report for the JavaScript code is generated in the `coverage/lcov-report` directory.
+Please add JavaScript [unit tests](https://github.com/lovell/sharp/tree/main/test/unit) to cover your new feature.
+Please also update the [TypeScript definitions](https://github.com/lovell/sharp/tree/main/lib/index.d.ts), along with the [type definition tests](https://github.com/lovell/sharp/tree/main/test/types/sharp.test-d.ts).
Where possible, the functional tests use gradient-based perceptual hashes
based on [dHash](http://www.hackerfactor.com/blog/index.php?/archives/529-Kind-of-Like-That.html)
to compare expected vs actual images.
-You deserve to add your details to the [list of contributors](https://github.com/lovell/sharp/blob/master/package.json#L5).
+You deserve to add your details to the [list of contributors](https://github.com/lovell/sharp/blob/main/package.json#L5).
Any change that modifies the existing public API should be added to the relevant work-in-progress branch for inclusion in the next major release.
@@ -62,7 +60,7 @@ By way of example, the `background()` method present in v0.20.0 was deprecated i
## Documentation
-The public API is documented with [JSDoc](http://usejsdoc.org/) annotated comments.
+The public API is documented with [JSDoc](https://jsdoc.app/) annotated comments.
These can be converted to Markdown by running:
```sh
@@ -93,5 +91,5 @@ Please feel free to ask any questions via a
[new issue](https://github.com/lovell/sharp/issues/new).
If you're unable to post details publicly, please
-[e-mail](https://github.com/lovell/sharp/blob/master/package.json#L5)
+[e-mail](https://github.com/lovell/sharp/blob/main/package.json#L5)
for private, paid consulting.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
index 69fc9b99c..d87e090af 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -5,12 +5,24 @@ labels: enhancement
---
-What are you trying to achieve?
+## Feature request
-Have you searched for similar feature requests?
+### What are you trying to achieve?
-What would you expect the API to look like?
+
-What alternatives have you considered?
+### When you searched for similar feature requests, what did you find that might be related?
-Is there a sample image that helps explain?
+
+
+### What would you expect the API to look like?
+
+
+
+### What alternatives have you considered?
+
+
+
+### Please provide sample image(s) that help explain this feature
+
+
diff --git a/.github/ISSUE_TEMPLATE/installation.md b/.github/ISSUE_TEMPLATE/installation.md
index 7bd2101fb..b47d10e9a 100644
--- a/.github/ISSUE_TEMPLATE/installation.md
+++ b/.github/ISSUE_TEMPLATE/installation.md
@@ -5,18 +5,65 @@ labels: installation
---
-Did you see the [documentation relating to installation](https://sharp.pixelplumbing.com/install)?
+
-Have you ensured the architecture and platform of Node.js used for `npm install` is the same as the architecture and platform of Node.js used at runtime?
+## Possible install-time or require-time problem
-Are you using the latest version? Is the version currently in use as reported by `npm ls sharp` the same as the latest version as reported by `npm view sharp dist-tags.latest`?
+
-If you are using npm v6 or earlier and installing as a `root` or `sudo` user, have you tried with the `npm install --unsafe-perm` flag?
+- [ ] I have read and understood all of the [documentation relating to installation](https://sharp.pixelplumbing.com/install).
+- [ ] I have searched for known bugs relating to this problem in my choice of package manager.
-If you are using npm v7, does the user running `npm install` own the directory it is run in?
+You must confirm both of these before continuing.
-If you are using the `ignore-scripts` feature of `npm`, have you tried with the `npm install --ignore-scripts=false` flag?
+### Are you using the latest version of sharp?
-What is the complete output of running `npm install --verbose sharp`? Have you checked this output for useful error messages?
+
-What is the output of running `npx envinfo --binaries --system`?
+- [ ] I am using the latest version of `sharp` as reported by `npm view sharp dist-tags.latest`.
+
+If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
+
+If you are using another package which depends on a version of `sharp` that is not the latest,
+please open an issue against that package instead.
+
+### Are you using a supported runtime?
+
+
+
+- [ ] I am using Node.js with a version that satisfies `^18.17.0 || ^20.3.0 || >=21.0.0`
+- [ ] I am using Deno
+- [ ] I am using Bun
+
+If you cannot confirm any of these,
+please upgrade to the latest version
+and try again before opening an issue.
+
+### Are you using a supported package manager and installing optional dependencies?
+
+
+
+- [ ] I am using npm >= 10.1.0 with `--include=optional`
+- [ ] I am using yarn >= 3.2.0
+- [ ] I am using pnpm >= 7.1.0 with `--no-optional=false`
+- [ ] I am using Deno
+- [ ] I am using Bun
+
+If you cannot confirm any of these, please upgrade to the latest version of your chosen package manager
+and ensure you are allowing the installation of optional or multi-platform dependencies before opening an issue.
+
+### What is the complete error message, including the full stack trace?
+
+
+
+### What is the complete output of running `npm install --verbose --foreground-scripts sharp` in an empty directory?
+
+
+
+
+
+
+
+### What is the output of running `npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp`?
+
+
diff --git a/.github/ISSUE_TEMPLATE/possible-bug.md b/.github/ISSUE_TEMPLATE/possible-bug.md
index 14b21b91d..c7e130e17 100644
--- a/.github/ISSUE_TEMPLATE/possible-bug.md
+++ b/.github/ISSUE_TEMPLATE/possible-bug.md
@@ -7,14 +7,59 @@ labels: triage
-Are you using the latest version? Is the version currently in use as reported by `npm ls sharp` the same as the latest version as reported by `npm view sharp dist-tags.latest`?
+## Possible bug
-What are the steps to reproduce?
+### Is this a possible bug in a feature of sharp, unrelated to installation?
-What is the expected behaviour?
+
-Are you able to provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem?
+- [ ] Running `npm install sharp` completes without error.
+- [ ] Running `node -e "require('sharp')"` completes without error.
-Are you able to provide a sample image that helps explain the problem?
+If you cannot confirm both of these, please open an [installation issue](https://github.com/lovell/sharp/issues/new?labels=installation&template=installation.md) instead.
-What is the output of running `npx envinfo --binaries --system`?
+### Are you using the latest version of sharp?
+
+
+
+- [ ] I am using the latest version of `sharp` as reported by `npm view sharp dist-tags.latest`.
+
+If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
+
+If you are using another package which depends on a version of `sharp` that is not the latest, please open an issue against that package instead.
+
+### What is the output of running `npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp`?
+
+
+
+### Does this problem relate to file caching?
+
+The default behaviour of libvips is to cache input files, which can lead to `EBUSY` or `EPERM` errors on Windows.
+Use [`sharp.cache(false)`](https://sharp.pixelplumbing.com/api-utility#cache) to switch this feature off.
+
+- [ ] Adding `sharp.cache(false)` does not fix this problem.
+
+### Does this problem relate to images appearing to have been rotated by 90 degrees?
+
+Images that contain EXIF Orientation metadata are not auto-oriented. By default, EXIF metadata is removed.
+
+- To auto-orient pixel values use the parameter-less [`rotate()`](https://sharp.pixelplumbing.com/api-operation#rotate) operation.
+- To retain EXIF Orientation use [`keepExif()`](https://sharp.pixelplumbing.com/api-output#keepexif).
+
+- [ ] Using `rotate()` or `keepExif()` does not fix this problem.
+
+### What are the steps to reproduce?
+
+
+
+### What is the expected behaviour?
+
+
+
+### Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
+
+
+
+### Please provide sample image(s) that help explain this problem
+
+
diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md
index 92e31e4fa..8fbdb5f4d 100644
--- a/.github/ISSUE_TEMPLATE/question.md
+++ b/.github/ISSUE_TEMPLATE/question.md
@@ -7,10 +7,20 @@ labels: question
-What are you trying to achieve?
+## Question about an existing feature
-Have you searched for similar questions?
+### What are you trying to achieve?
-Are you able to provide a minimal, standalone code sample that demonstrates this question?
+
-Are you able to provide a sample image that helps explain the question?
+### When you searched for similar issues, what did you find that might be related?
+
+
+
+### Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question
+
+
+
+### Please provide sample image(s) that help explain this question
+
+
diff --git a/.github/SECURITY.md b/.github/SECURITY.md
new file mode 100644
index 000000000..e17f100b8
--- /dev/null
+++ b/.github/SECURITY.md
@@ -0,0 +1,18 @@
+# Security Policy
+
+## Supported Versions
+
+The latest version of `sharp` as published to npm
+and reported by `npm view sharp dist-tags.latest`
+is supported with security updates.
+
+## Reporting a Vulnerability
+
+Please use
+[e-mail](https://github.com/lovell/sharp/blob/main/package.json#L5)
+to report a vulnerability.
+
+You can expect a response within 48 hours
+if you are a human reporting a genuine issue.
+
+Thank you in advance.
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index eefcee3c5..cd6838590 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,87 +1,356 @@
+name: CI
on:
- push
- pull_request
+permissions: {}
jobs:
- CI:
+ lint:
+ permissions:
+ contents: read
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v5
+ with:
+ node-version: "24"
+ - run: npm install --ignore-scripts
+ - run: npm run lint-cpp
+ - run: npm run lint-js
+ - run: npm run lint-types
+ build-native:
+ permissions:
+ contents: read
+ needs: lint
+ name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include:
- - os: ubuntu-20.04
- container: centos:7
- nodejs_version: 10
- coverage: true
- prebuild: true
- - os: ubuntu-20.04
- container: centos:7
- nodejs_version: 12
- - os: ubuntu-20.04
- container: centos:7
- nodejs_version: 14
- - os: ubuntu-20.04
- container: centos:7
- nodejs_version: 15
- - os: ubuntu-20.04
- container: node:10-alpine3.11
- prebuild: true
- - os: ubuntu-20.04
- container: node:12-alpine3.11
- - os: ubuntu-20.04
- container: node:14-alpine3.11
- - os: ubuntu-20.04
- container: node:14-alpine3.13
- - os: ubuntu-20.04
- container: node:15-alpine3.11
- - os: macos-10.15
- nodejs_version: 10
- prebuild: true
- - os: macos-10.15
- nodejs_version: 12
- - os: macos-10.15
- nodejs_version: 14
- - os: macos-10.15
- nodejs_version: 15
- - os: windows-2019
- nodejs_version: 10
- prebuild: true
- - os: windows-2019
- nodejs_version: 12
- - os: windows-2019
- nodejs_version: 14
- - os: windows-2019
- nodejs_version: 15
+ - os: ubuntu-24.04
+ container: rockylinux:8
+ nodejs_arch: x64
+ nodejs_version: "^18.17.0"
+ nodejs_version_major: 18
+ platform: linux-x64
+ package: true
+ - os: ubuntu-24.04
+ container: rockylinux:8
+ nodejs_arch: x64
+ nodejs_version: "^20.3.0"
+ nodejs_version_major: 20
+ platform: linux-x64
+ - os: ubuntu-24.04
+ container: rockylinux:8
+ nodejs_arch: x64
+ nodejs_version: "^22.9.0"
+ nodejs_version_major: 22
+ platform: linux-x64
+ - os: ubuntu-24.04
+ container: node:18-alpine3.17
+ nodejs_version_major: 18
+ platform: linuxmusl-x64
+ package: true
+ - os: ubuntu-24.04
+ container: node:20-alpine3.18
+ nodejs_version_major: 20
+ platform: linuxmusl-x64
+ - os: ubuntu-24.04
+ container: node:22-alpine3.20
+ nodejs_version_major: 22
+ platform: linuxmusl-x64
+ - os: ubuntu-24.04-arm
+ container: arm64v8/rockylinux:8
+ nodejs_arch: arm64
+ nodejs_version: "^18.17.0"
+ nodejs_version_major: 18
+ platform: linux-arm64
+ package: true
+ - os: ubuntu-24.04-arm
+ container: arm64v8/rockylinux:8
+ nodejs_arch: arm64
+ nodejs_version: "^20.3.0"
+ nodejs_version_major: 20
+ platform: linux-arm64
+ - os: macos-15-intel
+ nodejs_arch: x64
+ nodejs_version: "^18.17.0"
+ nodejs_version_major: 18
+ platform: darwin-x64
+ package: true
+ - os: macos-15-intel
+ nodejs_arch: x64
+ nodejs_version: "^20.3.0"
+ nodejs_version_major: 20
+ platform: darwin-x64
+ - os: macos-15-intel
+ nodejs_arch: x64
+ nodejs_version: "^22.9.0"
+ nodejs_version_major: 22
+ platform: darwin-x64
+ - os: macos-15
+ nodejs_arch: arm64
+ nodejs_version: "^18.17.0"
+ nodejs_version_major: 18
+ platform: darwin-arm64
+ package: true
+ - os: macos-15
+ nodejs_arch: arm64
+ nodejs_version: "^20.3.0"
+ nodejs_version_major: 20
+ platform: darwin-arm64
+ - os: macos-15
+ nodejs_arch: arm64
+ nodejs_version: "^22.9.0"
+ nodejs_version_major: 22
+ platform: darwin-arm64
+ - os: windows-2022
+ nodejs_arch: x86
+ nodejs_version: "18.18.2" # pinned to avoid 18.19.0 and npm 10
+ nodejs_version_major: 18
+ platform: win32-ia32
+ package: true
+ - os: windows-2022
+ nodejs_arch: x86
+ nodejs_version: "^20.3.0"
+ nodejs_version_major: 20
+ platform: win32-ia32
+ - os: windows-2022
+ nodejs_arch: x86
+ nodejs_version: "^22.9.0"
+ nodejs_version_major: 22
+ platform: win32-ia32
+ - os: windows-2022
+ nodejs_arch: x64
+ nodejs_version: "^18.17.0"
+ nodejs_version_major: 18
+ platform: win32-x64
+ package: true
+ - os: windows-2022
+ nodejs_arch: x64
+ nodejs_version: "^20.3.0"
+ nodejs_version_major: 20
+ platform: win32-x64
+ - os: windows-2022
+ nodejs_arch: x64
+ nodejs_version: "^22.9.0"
+ nodejs_version_major: 22
+ platform: win32-x64
+ - os: windows-11-arm
+ nodejs_arch: arm64
+ nodejs_version: "^20.3.0"
+ nodejs_version_major: 20
+ platform: win32-arm64
+ package: true
+ - os: windows-11-arm
+ nodejs_arch: arm64
+ nodejs_version: "^22.9.0"
+ nodejs_version_major: 22
+ platform: win32-arm64
steps:
- - name: Dependencies (Linux glibc)
- if: contains(matrix.container, 'centos')
+ - name: Dependencies (Rocky Linux glibc)
+ if: contains(matrix.container, 'rockylinux')
run: |
- curl -sL https://rpm.nodesource.com/setup_${{ matrix.nodejs_version }}.x | bash -
- yum install -y gcc-c++ make git python3 nodejs
+ dnf install -y gcc-toolset-14-gcc-c++ make git python3.12 fontconfig google-noto-sans-fonts
+ echo "/opt/rh/gcc-toolset-14/root/usr/bin" >> $GITHUB_PATH
- name: Dependencies (Linux musl)
if: contains(matrix.container, 'alpine')
- run: apk add build-base git python3 --update-cache
- - name: Dependencies (macOS, Windows)
+ run: apk add build-base git python3 font-noto --update-cache
+ - name: Dependencies (Python 3.11 - macOS, Windows)
if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows')
- uses: actions/setup-node@v1
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.12"
+ - name: Dependencies (Node.js)
+ if: "!contains(matrix.platform, 'linuxmusl')"
+ uses: actions/setup-node@v5
with:
node-version: ${{ matrix.nodejs_version }}
- - name: Checkout
- uses: actions/checkout@v2
- - name: Fix working directory ownership
- if: matrix.container
- run: chown root.root .
- - name: Install
- run: npm install --build-from-source --unsafe-perm
- - name: Test
- run: npm test
- - name: Coverage
- if: matrix.coverage
- uses: coverallsapp/github-action@v1.1.2
+ architecture: ${{ matrix.nodejs_arch }}
+ - uses: actions/checkout@v4
+ - run: npm install
+ - run: npm run build
+ - run: npm run test-unit
+ - if: matrix.package
+ run: npm run package-from-local-build
+ - uses: actions/upload-artifact@v4
+ if: matrix.package
+ with:
+ name: ${{ matrix.platform }}
+ path: npm/${{ matrix.platform }}
+ retention-days: 1
+ if-no-files-found: error
+ build-linuxmusl-arm64:
+ permissions:
+ contents: read
+ needs: lint
+ name: "build-linuxmusl-arm64 [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
+ runs-on: ubuntu-24.04-arm
+ container:
+ image: ${{ matrix.container }}
+ volumes:
+ - /opt:/opt:rw,rshared
+ - /opt:/__e/node20:ro,rshared
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - container: node:18-alpine3.17
+ nodejs_version_major: 18
+ package: true
+ - container: node:20-alpine3.18
+ nodejs_version_major: 20
+ steps:
+ - name: Allow Linux musl containers on ARM64 runners # https://github.com/actions/runner/issues/801#issuecomment-2394425757
+ shell: sh
+ run: |
+ sed -i "/^ID=/s/alpine/NotpineForGHA/" /etc/os-release
+ apk add nodejs --update-cache
+ mkdir /opt/bin
+ ln -s /usr/bin/node /opt/bin/node
+ - name: Dependencies
+ run: apk add build-base git python3 font-noto --update-cache
+ - uses: actions/checkout@v4
+ - run: npm install
+ - run: npm run build
+ - run: npm run test-unit
+ - if: matrix.package
+ run: npm run package-from-local-build
+ - uses: actions/upload-artifact@v4
+ if: matrix.package
+ with:
+ name: linuxmusl-arm64
+ path: npm/linuxmusl-arm64
+ retention-days: 1
+ if-no-files-found: error
+ build-qemu:
+ permissions:
+ contents: read
+ needs: lint
+ name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] [package]"
+ runs-on: ubuntu-24.04
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - platform: linux-arm
+ base_image: "balenalib/rpi-raspbian:bullseye"
+ nodejs_arch: armv6l
+ nodejs_hostname: unofficial-builds.nodejs.org
+ nodejs_version: "18.17.0"
+ nodejs_version_major: 18
+ - platform: linux-s390x
+ base_image: "--platform=linux/s390x s390x/debian:bookworm"
+ nodejs_arch: s390x
+ nodejs_hostname: nodejs.org
+ nodejs_version: "18.17.0"
+ nodejs_version_major: 18
+ - platform: linux-ppc64
+ base_image: "--platform=linux/ppc64le ppc64le/debian:bookworm"
+ nodejs_arch: ppc64le
+ nodejs_hostname: nodejs.org
+ nodejs_version: "18.17.0"
+ nodejs_version_major: 18
+ - platform: linux-riscv64
+ base_image: "--platform=linux/riscv64 riscv64/debian:trixie"
+ compiler_flags: "-march=rv64gc"
+ nodejs_arch: riscv64
+ nodejs_hostname: unofficial-builds.nodejs.org
+ nodejs_version: "20.19.5"
+ nodejs_version_major: 20
+ steps:
+ - uses: actions/checkout@v4
+ - uses: uraimo/run-on-arch-action@v3
+ with:
+ arch: none
+ distro: none
+ base_image: ${{ matrix.base_image }}
+ env: |
+ CFLAGS: "${{ matrix.compiler_flags }}"
+ CXXFLAGS: "${{ matrix.compiler_flags }}"
+ run: |
+ apt-get update
+ apt-get install -y curl g++ git libatomic1 make python3 xz-utils
+ mkdir /opt/nodejs
+ curl --silent https://${{ matrix.nodejs_hostname }}/download/release/v${{ matrix.nodejs_version}}/node-v${{ matrix.nodejs_version}}-linux-${{ matrix.nodejs_arch }}.tar.xz | tar xJC /opt/nodejs --strip-components=1
+ export PATH=$PATH:/opt/nodejs/bin
+ npm install
+ npm run build
+ node --test test/unit/io.js
+ npm run package-from-local-build
+ - uses: actions/upload-artifact@v4
+ with:
+ name: ${{ matrix.platform }}
+ path: npm/${{ matrix.platform }}
+ retention-days: 1
+ if-no-files-found: error
+ build-emscripten:
+ permissions:
+ contents: read
+ needs: lint
+ name: "build-wasm32 [package]"
+ runs-on: ubuntu-24.04
+ container: "emscripten/emsdk:4.0.18"
+ steps:
+ - uses: actions/checkout@v4
+ - name: Dependencies
+ run: apt-get update && apt-get install -y pkg-config
+ - name: Dependencies (Node.js)
+ uses: actions/setup-node@v5
+ with:
+ node-version: "20"
+ - run: npm install
+ - run: emmake npm run build
+ - name: Verify emscripten versions match
+ run: |
+ EMSCRIPTEN_VERSION_LIBVIPS=$(node -p "require('@img/sharp-libvips-dev-wasm32/versions').emscripten")
+ EMSCRIPTEN_VERSION_SHARP=$(emcc -dumpversion)
+ echo "libvips built with emscripten $EMSCRIPTEN_VERSION_LIBVIPS"
+ echo "sharp built with emscripten $EMSCRIPTEN_VERSION_SHARP"
+ test "$EMSCRIPTEN_VERSION_LIBVIPS" = "$EMSCRIPTEN_VERSION_SHARP"
+ - run: emmake npm run test-unit
+ - run: emmake npm run package-from-local-build
+ - uses: actions/upload-artifact@v4
+ with:
+ name: wasm32
+ path: npm/wasm32
+ retention-days: 1
+ if-no-files-found: error
+ release:
+ permissions:
+ contents: write
+ id-token: write
+ runs-on: ubuntu-24.04
+ needs:
+ - build-native
+ - build-linuxmusl-arm64
+ - build-qemu
+ - build-emscripten
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/download-artifact@v4
+ with:
+ path: npm
+ - name: Create npm workspace tarball
+ run: tar -vcaf npm-workspace.tar.xz --directory npm --exclude=from-local-build.js .
+ - uses: actions/setup-node@v5
+ with:
+ node-version: '24'
+ - name: Create release notes
+ run: npm run package-release-notes
+ - name: Create GitHub release for tag
+ if: startsWith(github.ref, 'refs/tags/v')
+ uses: ncipollo/release-action@v1
with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- - name: Prebuild
- if: matrix.prebuild && startsWith(github.ref, 'refs/tags/')
- env:
- prebuild_upload: ${{ secrets.GITHUB_TOKEN }}
- run: npx prebuild --runtime napi --target 3
+ artifacts: npm-workspace.tar.xz
+ artifactContentType: application/x-xz
+ prerelease: ${{ contains(github.ref, '-rc') }}
+ makeLatest: ${{ !contains(github.ref, '-rc') }}
+ bodyFile: release-notes.md
+ - name: Publish platform-specific npm packages
+ if: startsWith(github.ref, 'refs/tags/v')
+ run: cd npm && npm publish --workspaces --tag=${{ contains(github.ref, '-rc') && 'next' || 'latest' }}
+ - name: Publish sharp npm package
+ if: startsWith(github.ref, 'refs/tags/v')
+ run: npm publish --tag=${{ contains(github.ref, '-rc') && 'next' || 'latest' }}
diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml
new file mode 100644
index 000000000..4db44a5b4
--- /dev/null
+++ b/.github/workflows/npm.yml
@@ -0,0 +1,196 @@
+name: "CI: npm smoke test"
+
+on:
+ push:
+ tags:
+ - "v**"
+
+permissions: {}
+
+jobs:
+ release-smoke-test:
+ name: "${{ github.ref_name }} ${{ matrix.name }}"
+ runs-on: ${{ matrix.runs-on }}
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - name: linux-x64-node-npm
+ runs-on: ubuntu-24.04
+ runtime: node
+ package-manager: npm
+ - name: linux-x64-node-pnpm
+ runs-on: ubuntu-24.04
+ runtime: node
+ package-manager: pnpm
+ - name: linux-x64-node-yarn
+ runs-on: ubuntu-24.04
+ runtime: node
+ package-manager: yarn
+ - name: linux-x64-node-yarn-pnp
+ runs-on: ubuntu-24.04
+ runtime: node
+ package-manager: yarn-pnp
+ - name: linux-x64-node-yarn-v1
+ runs-on: ubuntu-24.04
+ runtime: node
+ package-manager: yarn-v1
+ - name: linux-x64-deno
+ runs-on: ubuntu-24.04
+ runtime: deno
+ - name: linux-x64-bun
+ runs-on: ubuntu-24.04
+ runtime: bun
+
+ - name: darwin-x64-node-npm
+ runs-on: macos-15-intel
+ runtime: node
+ package-manager: npm
+ - name: darwin-x64-node-pnpm
+ runs-on: macos-15-intel
+ runtime: node
+ package-manager: pnpm
+ - name: darwin-x64-node-yarn
+ runs-on: macos-15-intel
+ runtime: node
+ package-manager: yarn
+ - name: darwin-x64-node-yarn-pnp
+ runs-on: macos-15-intel
+ runtime: node
+ package-manager: yarn-pnp
+ - name: darwin-x64-node-yarn-v1
+ runs-on: macos-15-intel
+ runtime: node
+ package-manager: yarn-v1
+ - name: darwin-x64-deno
+ runs-on: macos-15-intel
+ runtime: deno
+ - name: darwin-x64-bun
+ runs-on: macos-15-intel
+ runtime: bun
+
+ - name: win32-x64-node-npm
+ runs-on: windows-2022
+ runtime: node
+ package-manager: npm
+ - name: win32-x64-node-pnpm
+ runs-on: windows-2022
+ runtime: node
+ package-manager: pnpm
+ - name: win32-x64-node-yarn
+ runs-on: windows-2022
+ runtime: node
+ package-manager: yarn
+ - name: win32-x64-node-yarn-pnp
+ runs-on: windows-2022
+ runtime: node
+ package-manager: yarn-pnp
+ - name: win32-x64-node-yarn-v1
+ runs-on: windows-2022
+ runtime: node
+ package-manager: yarn-v1
+ - name: win32-x64-deno
+ runs-on: windows-2022
+ runtime: deno
+
+ steps:
+ - name: Install Node.js
+ if: ${{ matrix.runtime == 'node' }}
+ uses: actions/setup-node@v5
+ with:
+ node-version: 20
+ - name: Install pnpm
+ if: ${{ matrix.package-manager == 'pnpm' }}
+ uses: pnpm/action-setup@v4
+ with:
+ version: 8
+ - name: Install Deno
+ if: ${{ matrix.runtime == 'deno' }}
+ uses: denoland/setup-deno@v2
+ with:
+ deno-version: v2.x
+ - name: Install Bun
+ if: ${{ matrix.runtime == 'bun' }}
+ uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: latest
+
+ - name: Version
+ id: version
+ uses: actions/github-script@v8
+ with:
+ script: |
+ core.setOutput('semver', context.ref.replace('refs/tags/v',''))
+ - name: Create package.json
+ uses: DamianReeves/write-file-action@v1.3
+ with:
+ path: package.json
+ contents: |
+ {
+ "dependencies": {
+ "sharp": "${{ steps.version.outputs.semver }}"
+ },
+ "type": "module"
+ }
+ - name: Create release.mjs
+ uses: DamianReeves/write-file-action@v1.3
+ with:
+ path: release.mjs
+ contents: |
+ import { deepStrictEqual } from 'node:assert';
+ import sharp from 'sharp';
+ deepStrictEqual(['.jpg', '.jpeg', '.jpe', '.jfif'], sharp.format.jpeg.input.fileSuffix);
+
+ - name: Run with Node.js + npm
+ if: ${{ matrix.package-manager == 'npm' }}
+ run: |
+ npm install --ignore-scripts
+ node release.mjs
+
+ - name: Run with Node.js + pnpm
+ if: ${{ matrix.package-manager == 'pnpm' }}
+ run: |
+ pnpm install --ignore-scripts
+ node release.mjs
+
+ - name: Run with Node.js + yarn
+ if: ${{ matrix.package-manager == 'yarn' }}
+ run: |
+ corepack enable
+ yarn set version stable
+ yarn config set enableImmutableInstalls false
+ yarn config set enableScripts false
+ yarn config set nodeLinker node-modules
+ yarn install
+ node release.mjs
+
+ - name: Run with Node.js + yarn pnp
+ if: ${{ matrix.package-manager == 'yarn-pnp' }}
+ run: |
+ corepack enable
+ yarn set version stable
+ yarn config set enableImmutableInstalls false
+ yarn config set enableScripts false
+ yarn config set nodeLinker pnp
+ yarn install
+ yarn node release.mjs
+
+ - name: Run with Node.js + yarn v1
+ if: ${{ matrix.package-manager == 'yarn-v1' }}
+ run: |
+ corepack enable
+ yarn set version classic
+ yarn install
+ node release.mjs
+
+ - name: Run with Deno
+ if: ${{ matrix.runtime == 'deno' }}
+ run: |
+ deno install
+ deno run --allow-env --allow-ffi --allow-read --allow-sys release.mjs
+
+ - name: Run with Bun
+ if: ${{ matrix.runtime == 'bun' }}
+ run: |
+ bun install --ignore-scripts
+ bun release.mjs
diff --git a/.gitignore b/.gitignore
index f5dd9a65d..82f73b3f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,18 +1,19 @@
-build
+src/build
+src/node_modules
node_modules
/coverage
+npm/*/*
+!npm/*/package.json
test/bench/node_modules
test/fixtures/output*
+test/fixtures/vips-properties.xml
test/leak/libvips.supp
-test/saliency/report.json
-test/saliency/Image*
-test/saliency/[Uu]serData*
-!test/saliency/userData.js
-vendor
-.gitattributes
.DS_Store
.nyc_output
.vscode/
package-lock.json
.idea
.firebase
+.astro
+docs/dist
+release-notes.md
diff --git a/.prebuildrc b/.prebuildrc
deleted file mode 100644
index e9978aa33..000000000
--- a/.prebuildrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "include-regex": "(sharp\\.node|libvips-cpp\\.dll)",
- "strip": true
-}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 307e91452..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,108 +0,0 @@
-jobs:
- include:
- - name: "Linux ARM64v8 (Debian 11, glibc 2.29) - Node.js 10"
- arch: arm64
- os: linux
- dist: bionic
- language: shell
- before_install:
- - sudo docker run -dit --name sharp --volume "${PWD}:/mnt/sharp" --workdir /mnt/sharp arm64v8/debian:bullseye
- - sudo docker exec sharp sh -c "apt-get update && apt-get install -y build-essential git python3 curl"
- - sudo docker exec sharp sh -c "curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -"
- - sudo docker exec sharp sh -c "echo 'deb https://deb.nodesource.com/node_10.x sid main' >/etc/apt/sources.list.d/nodesource.list"
- - sudo docker exec sharp sh -c "apt-get update && apt-get install -y nodejs=10.*"
- install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm"
- script: sudo docker exec sharp sh -c "npm test"
- after_success: "[[ -n $TRAVIS_TAG ]] && sudo docker exec --env prebuild_upload sharp sh -c \"npx prebuild --runtime napi --target 3\""
-
- - name: "Linux ARM64v8 (Debian 11, glibc 2.29) - Node.js 12"
- arch: arm64
- os: linux
- dist: bionic
- language: shell
- before_install:
- - sudo docker run -dit --name sharp --volume "${PWD}:/mnt/sharp" --workdir /mnt/sharp arm64v8/debian:bullseye
- - sudo docker exec sharp sh -c "apt-get update && apt-get install -y build-essential git python3 curl"
- - sudo docker exec sharp sh -c "curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -"
- - sudo docker exec sharp sh -c "echo 'deb https://deb.nodesource.com/node_12.x sid main' >/etc/apt/sources.list.d/nodesource.list"
- - sudo docker exec sharp sh -c "apt-get update && apt-get install -y nodejs"
- install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm"
- script: sudo docker exec sharp sh -c "npm test"
-
- - name: "Linux ARM64v8 (Debian 11, glibc 2.29) - Node.js 14"
- arch: arm64
- os: linux
- dist: bionic
- language: shell
- before_install:
- - sudo docker run -dit --name sharp --volume "${PWD}:/mnt/sharp" --workdir /mnt/sharp arm64v8/debian:bullseye
- - sudo docker exec sharp sh -c "apt-get update && apt-get install -y build-essential git python3 curl"
- - sudo docker exec sharp sh -c "curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -"
- - sudo docker exec sharp sh -c "echo 'deb https://deb.nodesource.com/node_14.x sid main' >/etc/apt/sources.list.d/nodesource.list"
- - sudo docker exec sharp sh -c "apt-get update && apt-get install -y nodejs"
- install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm"
- script: sudo docker exec sharp sh -c "npm test"
-
- - name: "Linux ARM64v8 (Debian 11, glibc 2.29) - Node.js 15"
- arch: arm64
- os: linux
- dist: bionic
- language: shell
- before_install:
- - sudo chown 0.0 ${PWD}
- - sudo docker run -dit --name sharp --volume "${PWD}:/mnt/sharp" --workdir /mnt/sharp arm64v8/debian:bullseye
- - sudo docker exec sharp sh -c "apt-get update && apt-get install -y build-essential git python3 curl"
- - sudo docker exec sharp sh -c "curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -"
- - sudo docker exec sharp sh -c "echo 'deb https://deb.nodesource.com/node_15.x sid main' >/etc/apt/sources.list.d/nodesource.list"
- - sudo docker exec sharp sh -c "apt-get update && apt-get install -y nodejs"
- install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm"
- script: sudo docker exec sharp sh -c "npm test"
-
- - name: "Linux ARM64v8 (Alpine 3.11, musl 1.1.24) - Node.js 10"
- arch: arm64
- os: linux
- dist: focal
- language: shell
- before_install:
- - sudo docker run -dit --name sharp --volume "${PWD}:/mnt/sharp" --workdir /mnt/sharp node:10-alpine3.11
- - sudo docker exec sharp sh -c "apk add build-base git python3 --update-cache"
- install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm"
- script: sudo docker exec sharp sh -c "npm test"
- after_success: "[[ -n $TRAVIS_TAG ]] && sudo docker exec --env prebuild_upload sharp sh -c \"npx prebuild --runtime napi --target 3\""
-
- - name: "Linux ARM64v8 (Alpine 3.11, musl 1.1.24) - Node.js 12"
- arch: arm64
- os: linux
- dist: focal
- language: shell
- before_install:
- - sudo docker run -dit --name sharp --volume "${PWD}:/mnt/sharp" --workdir /mnt/sharp node:12-alpine3.11
- - sudo docker exec sharp sh -c "apk add build-base git python3 --update-cache"
- install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm"
- script: sudo docker exec sharp sh -c "npm test"
-
- - name: "Linux ARM64v8 (Alpine 3.11, musl 1.1.24) - Node.js 14"
- arch: arm64
- os: linux
- dist: focal
- language: shell
- before_install:
- - sudo docker run -dit --name sharp --volume "${PWD}:/mnt/sharp" --workdir /mnt/sharp node:14-alpine3.11
- - sudo docker exec sharp sh -c "apk add build-base git python3 --update-cache"
- install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm"
- script: sudo docker exec sharp sh -c "npm test"
-
- - name: "Linux ARM64v8 (Alpine 3.11, musl 1.1.24) - Node.js 15"
- arch: arm64
- os: linux
- dist: focal
- language: shell
- before_install:
- - sudo chown 0.0 ${PWD}
- - sudo docker run -dit --name sharp --volume "${PWD}:/mnt/sharp" --workdir /mnt/sharp node:15-alpine3.11
- - sudo docker exec sharp sh -c "apk add build-base git python3 --update-cache"
- install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm"
- script: sudo docker exec sharp sh -c "npm test"
-
-cache:
- npm: false
diff --git a/README.md b/README.md
index 22d735865..47da52e8b 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,14 @@
# sharp
-
+
-The typical use case for this high speed Node.js module
+The typical use case for this high speed Node-API module
is to convert large images in common formats to
-smaller, web-friendly JPEG, PNG, WebP and AVIF images of varying dimensions.
+smaller, web-friendly JPEG, PNG, WebP, GIF and AVIF images of varying dimensions.
+
+It can be used with all JavaScript runtimes
+that provide support for Node-API v9, including
+Node.js (^18.17.0 or >= 20.3.0), Deno and Bun.
Resizing an image is typically 4x-5x faster than using the
quickest ImageMagick and GraphicsMagick settings
@@ -16,7 +20,7 @@ Lanczos resampling ensures quality is not sacrificed for speed.
As well as image resizing, operations such as
rotation, extraction, compositing and gamma correction are available.
-Most modern macOS, Windows and Linux systems running Node.js v10+
+Most modern macOS, Windows and Linux systems
do not require any additional install or runtime dependencies.
## Documentation
@@ -95,15 +99,12 @@ readableStream
## Contributing
-A [guide for contributors](https://github.com/lovell/sharp/blob/master/.github/CONTRIBUTING.md)
+A [guide for contributors](https://github.com/lovell/sharp/blob/main/.github/CONTRIBUTING.md)
covers reporting bugs, requesting features and submitting code changes.
-[](https://coveralls.io/r/lovell/sharp?branch=master)
-[](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api_version_matrix)
-
## Licensing
-Copyright 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Lovell Fuller and contributors.
+Copyright 2013 Lovell Fuller and others.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 8ddfa0e71..000000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-os: Visual Studio 2019
-version: "{build}"
-build: off
-platform: x86
-environment:
- matrix:
- - nodejs_version: "10"
- prebuild: true
- - nodejs_version: "12"
- - nodejs_version: "14"
- - nodejs_version: "15"
-install:
- - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
- - npm install --build-from-source
-test_script:
- - npm test
-on_success:
- - if [%prebuild%] == [true] if [%APPVEYOR_REPO_TAG%] == [true] npx prebuild --runtime napi --target 3
diff --git a/binding.gyp b/binding.gyp
deleted file mode 100644
index b3443dc69..000000000
--- a/binding.gyp
+++ /dev/null
@@ -1,230 +0,0 @@
-{
- 'variables': {
- 'vips_version': '
-
-## removeAlpha
-
-Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel.
-
-### Examples
-
-```javascript
-sharp('rgba.png')
- .removeAlpha()
- .toFile('rgb.png', function(err, info) {
- // rgb.png is a 3 channel image without an alpha channel
- });
-```
-
-Returns **Sharp**
-
-## ensureAlpha
-
-Ensure alpha channel, if missing. The added alpha channel will be fully opaque. This is a no-op if the image already has an alpha channel.
-
-### Examples
-
-```javascript
-sharp('rgb.jpg')
- .ensureAlpha()
- .toFile('rgba.png', function(err, info) {
- // rgba.png is a 4 channel image with a fully opaque alpha channel
- });
-```
-
-Returns **Sharp**
-
-**Meta**
-
-- **since**: 0.21.2
-
-## extractChannel
-
-Extract a single channel from a multi-channel image.
-
-### Parameters
-
-- `channel` **([number][1] \| [string][2])** zero-indexed channel/band number to extract, or `red`, `green`, `blue` or `alpha`.
-
-### Examples
-
-```javascript
-sharp(input)
- .extractChannel('green')
- .toColourspace('b-w')
- .toFile('green.jpg', function(err, info) {
- // info.channels === 1
- // green.jpg is a greyscale image containing the green channel of the input
- });
-```
-
-- Throws **[Error][3]** Invalid channel
-
-Returns **Sharp**
-
-## joinChannel
-
-Join one or more channels to the image.
-The meaning of the added channels depends on the output colourspace, set with `toColourspace()`.
-By default the output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
-Channel ordering follows vips convention:
-
-- sRGB: 0: Red, 1: Green, 2: Blue, 3: Alpha.
-- CMYK: 0: Magenta, 1: Cyan, 2: Yellow, 3: Black, 4: Alpha.
-
-Buffers may be any of the image formats supported by sharp.
-For raw pixel input, the `options` object should contain a `raw` attribute, which follows the format of the attribute of the same name in the `sharp()` constructor.
-
-### Parameters
-
-- `images` **([Array][4]<([string][2] \| [Buffer][5])> | [string][2] \| [Buffer][5])** one or more images (file paths, Buffers).
-- `options` **[Object][6]** image options, see `sharp()` constructor.
-
-
-- Throws **[Error][3]** Invalid parameters
-
-Returns **Sharp**
-
-## bandbool
-
-Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.
-
-### Parameters
-
-- `boolOp` **[string][2]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
-
-### Examples
-
-```javascript
-sharp('3-channel-rgb-input.png')
- .bandbool(sharp.bool.and)
- .toFile('1-channel-output.png', function (err, info) {
- // The output will be a single channel image where each pixel `P = R & G & B`.
- // If `I(1,1) = [247, 170, 14] = [0b11110111, 0b10101010, 0b00001111]`
- // then `O(1,1) = 0b11110111 & 0b10101010 & 0b00001111 = 0b00000010 = 2`.
- });
-```
-
-- Throws **[Error][3]** Invalid parameters
-
-Returns **Sharp**
-
-[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
-
-[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
-
-[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
-
-[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
-
-[5]: https://nodejs.org/api/buffer.html
-
-[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
diff --git a/docs/api-colour.md b/docs/api-colour.md
deleted file mode 100644
index 8dca338c1..000000000
--- a/docs/api-colour.md
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-## tint
-
-Tint the image using the provided chroma while preserving the image luminance.
-An alpha channel may be present and will be unchanged by the operation.
-
-### Parameters
-
-- `rgb` **([string][1] \| [Object][2])** parsed by the [color][3] module to extract chroma values.
-
-
-- Throws **[Error][4]** Invalid parameter
-
-Returns **Sharp**
-
-## greyscale
-
-Convert to 8-bit greyscale; 256 shades of grey.
-This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
-By default the output image will be web-friendly sRGB and contain three (identical) color channels.
-This may be overridden by other sharp operations such as `toColourspace('b-w')`,
-which will produce an output image containing one color channel.
-An alpha channel may be present, and will be unchanged by the operation.
-
-### Parameters
-
-- `greyscale` **[Boolean][5]** (optional, default `true`)
-
-Returns **Sharp**
-
-## grayscale
-
-Alternative spelling of `greyscale`.
-
-### Parameters
-
-- `grayscale` **[Boolean][5]** (optional, default `true`)
-
-Returns **Sharp**
-
-## toColourspace
-
-Set the output colourspace.
-By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
-
-### Parameters
-
-- `colourspace` **[string][1]?** output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...][6]
-
-### Examples
-
-```javascript
-// Output 16 bits per pixel RGB
-await sharp(input)
- .toColourspace('rgb16')
- .toFile('16-bpp.png')
-```
-
-- Throws **[Error][4]** Invalid parameters
-
-Returns **Sharp**
-
-## toColorspace
-
-Alternative spelling of `toColourspace`.
-
-### Parameters
-
-- `colorspace` **[string][1]?** output colorspace.
-
-
-- Throws **[Error][4]** Invalid parameters
-
-Returns **Sharp**
-
-[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
-
-[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
-
-[3]: https://www.npmjs.org/package/color
-
-[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
-
-[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
-
-[6]: https://github.com/libvips/libvips/blob/master/libvips/iofuncs/enumtypes.c#L568
diff --git a/docs/api-composite.md b/docs/api-composite.md
deleted file mode 100644
index 32a343bcf..000000000
--- a/docs/api-composite.md
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-## composite
-
-Composite image(s) over the processed (resized, extracted etc.) image.
-
-The images to composite must be the same size or smaller than the processed image.
-If both `top` and `left` options are provided, they take precedence over `gravity`.
-
-The `blend` option can be one of `clear`, `source`, `over`, `in`, `out`, `atop`,
-`dest`, `dest-over`, `dest-in`, `dest-out`, `dest-atop`,
-`xor`, `add`, `saturate`, `multiply`, `screen`, `overlay`, `darken`, `lighten`,
-`colour-dodge`, `color-dodge`, `colour-burn`,`color-burn`,
-`hard-light`, `soft-light`, `difference`, `exclusion`.
-
-More information about blend modes can be found at
-[https://libvips.github.io/libvips/API/current/libvips-conversion.html#VipsBlendMode][1]
-and [https://www.cairographics.org/operators/][2]
-
-### Parameters
-
-- `images` **[Array][3]<[Object][4]>** Ordered list of images to composite
- - `images[].input` **([Buffer][5] \| [String][6])?** Buffer containing image data, String containing the path to an image file, or Create object (see below)
- - `images[].input.create` **[Object][4]?** describes a blank overlay to be created.
- - `images[].input.create.width` **[Number][7]?**
- - `images[].input.create.height` **[Number][7]?**
- - `images[].input.create.channels` **[Number][7]?** 3-4
- - `images[].input.create.background` **([String][6] \| [Object][4])?** parsed by the [color][8] module to extract values for red, green, blue and alpha.
- - `images[].blend` **[String][6]** how to blend this image with the image below. (optional, default `'over'`)
- - `images[].gravity` **[String][6]** gravity at which to place the overlay. (optional, default `'centre'`)
- - `images[].top` **[Number][7]?** the pixel offset from the top edge.
- - `images[].left` **[Number][7]?** the pixel offset from the left edge.
- - `images[].tile` **[Boolean][9]** set to true to repeat the overlay image across the entire image with the given `gravity`. (optional, default `false`)
- - `images[].premultiplied` **[Boolean][9]** set to true to avoid premultipling the image below. Equivalent to the `--premultiplied` vips option. (optional, default `false`)
- - `images[].density` **[Number][7]** number representing the DPI for vector overlay image. (optional, default `72`)
- - `images[].raw` **[Object][4]?** describes overlay when using raw pixel data.
- - `images[].raw.width` **[Number][7]?**
- - `images[].raw.height` **[Number][7]?**
- - `images[].raw.channels` **[Number][7]?**
-
-### Examples
-
-```javascript
-sharp('input.png')
- .rotate(180)
- .resize(300)
- .flatten( { background: '#ff6600' } )
- .composite([{ input: 'overlay.png', gravity: 'southeast' }])
- .sharpen()
- .withMetadata()
- .webp( { quality: 90 } )
- .toBuffer()
- .then(function(outputBuffer) {
- // outputBuffer contains upside down, 300px wide, alpha channel flattened
- // onto orange background, composited with overlay.png with SE gravity,
- // sharpened, with metadata, 90% quality WebP image data. Phew!
- });
-```
-
-- Throws **[Error][10]** Invalid parameters
-
-Returns **Sharp**
-
-**Meta**
-
-- **since**: 0.22.0
-
-[1]: https://libvips.github.io/libvips/API/current/libvips-conversion.html#VipsBlendMode
-
-[2]: https://www.cairographics.org/operators/
-
-[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
-
-[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
-
-[5]: https://nodejs.org/api/buffer.html
-
-[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
-
-[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
-
-[8]: https://www.npmjs.org/package/color
-
-[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
-
-[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
diff --git a/docs/api-constructor.md b/docs/api-constructor.md
deleted file mode 100644
index 0fb93a541..000000000
--- a/docs/api-constructor.md
+++ /dev/null
@@ -1,214 +0,0 @@
-
-
-## Sharp
-
-Constructor factory to create an instance of `sharp`, to which further methods are chained.
-
-JPEG, PNG, WebP, AVIF or TIFF format image data can be streamed out from this object.
-When using Stream based output, derived attributes are available from the `info` event.
-
-Non-critical problems encountered during processing are emitted as `warning` events.
-
-Implements the [stream.Duplex][1] class.
-
-### Parameters
-
-- `input` **([Buffer][2] \| [Uint8Array][3] \| [Uint8ClampedArray][4] \| [string][5])?** if present, can be
- a Buffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data, or
- a String containing the filesystem path to an JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image file.
- JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present.
-- `options` **[Object][6]?** if present, is an Object with optional attributes.
- - `options.failOnError` **[boolean][7]** by default halt processing and raise an error when loading invalid images.
- Set this flag to `false` if you'd rather apply a "best effort" to decode images, even if the data is corrupt or invalid. (optional, default `true`)
- - `options.limitInputPixels` **([number][8] \| [boolean][7])** Do not process input images where the number of pixels
- (width x height) exceeds this limit. Assumes image dimensions contained in the input metadata can be trusted.
- An integral Number of pixels, zero or false to remove limit, true to use default limit of 268402689 (0x3FFF x 0x3FFF). (optional, default `268402689`)
- - `options.sequentialRead` **[boolean][7]** Set this to `true` to use sequential rather than random access where possible.
- This can reduce memory usage and might improve performance on some systems. (optional, default `false`)
- - `options.density` **[number][8]** number representing the DPI for vector images in the range 1 to 100000. (optional, default `72`)
- - `options.pages` **[number][8]** number of pages to extract for multi-page input (GIF, WebP, AVIF, TIFF, PDF), use -1 for all pages. (optional, default `1`)
- - `options.page` **[number][8]** page number to start extracting from for multi-page input (GIF, WebP, AVIF, TIFF, PDF), zero based. (optional, default `0`)
- - `options.level` **[number][8]** level to extract from a multi-level input (OpenSlide), zero based. (optional, default `0`)
- - `options.animated` **[boolean][7]** Set to `true` to read all frames/pages of an animated image (equivalent of setting `pages` to `-1`). (optional, default `false`)
- - `options.raw` **[Object][6]?** describes raw pixel input image data. See `raw()` for pixel ordering.
- - `options.raw.width` **[number][8]?** integral number of pixels wide.
- - `options.raw.height` **[number][8]?** integral number of pixels high.
- - `options.raw.channels` **[number][8]?** integral number of channels, between 1 and 4.
- - `options.create` **[Object][6]?** describes a new image to be created.
- - `options.create.width` **[number][8]?** integral number of pixels wide.
- - `options.create.height` **[number][8]?** integral number of pixels high.
- - `options.create.channels` **[number][8]?** integral number of channels, either 3 (RGB) or 4 (RGBA).
- - `options.create.background` **([string][5] \| [Object][6])?** parsed by the [color][9] module to extract values for red, green, blue and alpha.
- - `options.create.noise` **[Object][6]?** describes a noise to be created.
- - `options.create.noise.type` **[string][5]?** type of generated noise, currently only `gaussian` is supported.
- - `options.create.noise.mean` **[number][8]?** mean of pixels in generated noise.
- - `options.create.noise.sigma` **[number][8]?** standard deviation of pixels in generated noise.
-
-### Examples
-
-```javascript
-sharp('input.jpg')
- .resize(300, 200)
- .toFile('output.jpg', function(err) {
- // output.jpg is a 300 pixels wide and 200 pixels high image
- // containing a scaled and cropped version of input.jpg
- });
-```
-
-```javascript
-// Read image data from readableStream,
-// resize to 300 pixels wide,
-// emit an 'info' event with calculated dimensions
-// and finally write image data to writableStream
-var transformer = sharp()
- .resize(300)
- .on('info', function(info) {
- console.log('Image height is ' + info.height);
- });
-readableStream.pipe(transformer).pipe(writableStream);
-```
-
-```javascript
-// Create a blank 300x200 PNG image of semi-transluent red pixels
-sharp({
- create: {
- width: 300,
- height: 200,
- channels: 4,
- background: { r: 255, g: 0, b: 0, alpha: 0.5 }
- }
-})
-.png()
-.toBuffer()
-.then( ... );
-```
-
-```javascript
-// Convert an animated GIF to an animated WebP
-await sharp('in.gif', { animated: true }).toFile('out.webp');
-```
-
-```javascript
-// Read a raw array of pixels and save it to a png
-const input = Uint8Array.from([255, 255, 255, 0, 0, 0]); // or Uint8ClampedArray
-const image = sharp(input, {
- // because the input does not contain its dimensions or how many channels it has
- // we need to specify it in the constructor options
- raw: {
- width: 2,
- height: 1,
- channels: 3
- }
-});
-await image.toFile('my-two-pixels.png');
-```
-
-```javascript
-// Generate RGB Gaussian noise
-await sharp({
- create: {
- width: 300,
- height: 200,
- channels: 3,
- noise: {
- type: 'gaussian',
- mean: 128,
- sigma: 30
- }
- }
-}).toFile('noise.png');
-```
-
-- Throws **[Error][10]** Invalid parameters
-
-Returns **[Sharp][11]**
-
-## clone
-
-Take a "snapshot" of the Sharp instance, returning a new instance.
-Cloned instances inherit the input of their parent instance.
-This allows multiple output Streams and therefore multiple processing pipelines to share a single input Stream.
-
-### Examples
-
-```javascript
-const pipeline = sharp().rotate();
-pipeline.clone().resize(800, 600).pipe(firstWritableStream);
-pipeline.clone().extract({ left: 20, top: 20, width: 100, height: 100 }).pipe(secondWritableStream);
-readableStream.pipe(pipeline);
-// firstWritableStream receives auto-rotated, resized readableStream
-// secondWritableStream receives auto-rotated, extracted region of readableStream
-```
-
-```javascript
-// Create a pipeline that will download an image, resize it and format it to different files
-// Using Promises to know when the pipeline is complete
-const fs = require("fs");
-const got = require("got");
-const sharpStream = sharp({
- failOnError: false
-});
-
-const promises = [];
-
-promises.push(
- sharpStream
- .clone()
- .jpeg({ quality: 100 })
- .toFile("originalFile.jpg")
-);
-
-promises.push(
- sharpStream
- .clone()
- .resize({ width: 500 })
- .jpeg({ quality: 80 })
- .toFile("optimized-500.jpg")
-);
-
-promises.push(
- sharpStream
- .clone()
- .resize({ width: 500 })
- .webp({ quality: 80 })
- .toFile("optimized-500.webp")
-);
-
-// https://github.com/sindresorhus/got#gotstreamurl-options
-got.stream("https://www.example.com/some-file.jpg").pipe(sharpStream);
-
-Promise.all(promises)
- .then(res => { console.log("Done!", res); })
- .catch(err => {
- console.error("Error processing files, let's clean it up", err);
- try {
- fs.unlinkSync("originalFile.jpg");
- fs.unlinkSync("optimized-500.jpg");
- fs.unlinkSync("optimized-500.webp");
- } catch (e) {}
- });
-```
-
-Returns **[Sharp][11]**
-
-[1]: http://nodejs.org/api/stream.html#stream_class_stream_duplex
-
-[2]: https://nodejs.org/api/buffer.html
-
-[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
-
-[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray
-
-[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
-
-[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
-
-[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
-
-[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
-
-[9]: https://www.npmjs.org/package/color
-
-[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
-
-[11]: #sharp
diff --git a/docs/api-input.md b/docs/api-input.md
deleted file mode 100644
index 0b2509d1b..000000000
--- a/docs/api-input.md
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-## metadata
-
-Fast access to (uncached) image metadata without decoding any compressed image data.
-A `Promise` is returned when `callback` is not provided.
-
-- `format`: Name of decoder used to decompress image data e.g. `jpeg`, `png`, `webp`, `gif`, `svg`
-- `size`: Total size of image in bytes, for Stream and Buffer input only
-- `width`: Number of pixels wide (EXIF orientation is not taken into consideration)
-- `height`: Number of pixels high (EXIF orientation is not taken into consideration)
-- `space`: Name of colour space interpretation e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...][1]
-- `channels`: Number of bands e.g. `3` for sRGB, `4` for CMYK
-- `depth`: Name of pixel depth format e.g. `uchar`, `char`, `ushort`, `float` [...][2]
-- `density`: Number of pixels per inch (DPI), if present
-- `chromaSubsampling`: String containing JPEG chroma subsampling, `4:2:0` or `4:4:4` for RGB, `4:2:0:4` or `4:4:4:4` for CMYK
-- `isProgressive`: Boolean indicating whether the image is interlaced using a progressive scan
-- `pages`: Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP
-- `pageHeight`: Number of pixels high each page in a multi-page image will be.
-- `loop`: Number of times to loop an animated image, zero refers to a continuous loop.
-- `delay`: Delay in ms between each page in an animated image, provided as an array of integers.
-- `pagePrimary`: Number of the primary page in a HEIF image
-- `levels`: Details of each level in a multi-level image provided as an array of objects, requires libvips compiled with support for OpenSlide
-- `hasProfile`: Boolean indicating the presence of an embedded ICC profile
-- `hasAlpha`: Boolean indicating the presence of an alpha transparency channel
-- `orientation`: Number value of the EXIF Orientation header, if present
-- `exif`: Buffer containing raw EXIF data, if present
-- `icc`: Buffer containing raw [ICC][3] profile data, if present
-- `iptc`: Buffer containing raw IPTC data, if present
-- `xmp`: Buffer containing raw XMP data, if present
-- `tifftagPhotoshop`: Buffer containing raw TIFFTAG_PHOTOSHOP data, if present
-
-### Parameters
-
-- `callback` **[Function][4]?** called with the arguments `(err, metadata)`
-
-### Examples
-
-```javascript
-const image = sharp(inputJpg);
-image
- .metadata()
- .then(function(metadata) {
- return image
- .resize(Math.round(metadata.width / 2))
- .webp()
- .toBuffer();
- })
- .then(function(data) {
- // data contains a WebP image half the width and height of the original JPEG
- });
-```
-
-Returns **([Promise][5]<[Object][6]> | Sharp)**
-
-## stats
-
-Access to pixel-derived image statistics for every channel in the image.
-A `Promise` is returned when `callback` is not provided.
-
-- `channels`: Array of channel statistics for each channel in the image. Each channel statistic contains
- - `min` (minimum value in the channel)
- - `max` (maximum value in the channel)
- - `sum` (sum of all values in a channel)
- - `squaresSum` (sum of squared values in a channel)
- - `mean` (mean of the values in a channel)
- - `stdev` (standard deviation for the values in a channel)
- - `minX` (x-coordinate of one of the pixel where the minimum lies)
- - `minY` (y-coordinate of one of the pixel where the minimum lies)
- - `maxX` (x-coordinate of one of the pixel where the maximum lies)
- - `maxY` (y-coordinate of one of the pixel where the maximum lies)
-- `isOpaque`: Is the image fully opaque? Will be `true` if the image has no alpha channel or if every pixel is fully opaque.
-- `entropy`: Histogram-based estimation of greyscale entropy, discarding alpha channel if any (experimental)
-- `sharpness`: Estimation of greyscale sharpness based on the standard deviation of a Laplacian convolution, discarding alpha channel if any (experimental)
-- `dominant`: Object containing most dominant sRGB colour based on a 4096-bin 3D histogram (experimental)
-
-### Parameters
-
-- `callback` **[Function][4]?** called with the arguments `(err, stats)`
-
-### Examples
-
-```javascript
-const image = sharp(inputJpg);
-image
- .stats()
- .then(function(stats) {
- // stats contains the channel-wise statistics array and the isOpaque value
- });
-```
-
-```javascript
-const { entropy, sharpness, dominant } = await sharp(input).stats();
-const { r, g, b } = dominant;
-```
-
-Returns **[Promise][5]<[Object][6]>**
-
-[1]: https://libvips.github.io/libvips/API/current/VipsImage.html#VipsInterpretation
-
-[2]: https://libvips.github.io/libvips/API/current/VipsImage.html#VipsBandFormat
-
-[3]: https://www.npmjs.com/package/icc
-
-[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
-
-[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
-
-[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
diff --git a/docs/api-operation.md b/docs/api-operation.md
deleted file mode 100644
index cfcea48eb..000000000
--- a/docs/api-operation.md
+++ /dev/null
@@ -1,409 +0,0 @@
-
-
-## rotate
-
-Rotate the output image by either an explicit angle
-or auto-orient based on the EXIF `Orientation` tag.
-
-If an angle is provided, it is converted to a valid positive degree rotation.
-For example, `-450` will produce a 270deg rotation.
-
-When rotating by an angle other than a multiple of 90,
-the background colour can be provided with the `background` option.
-
-If no angle is provided, it is determined from the EXIF data.
-Mirroring is supported and may infer the use of a flip operation.
-
-The use of `rotate` implies the removal of the EXIF `Orientation` tag, if any.
-
-Method order is important when both rotating and extracting regions,
-for example `rotate(x).extract(y)` will produce a different result to `extract(y).rotate(x)`.
-
-### Parameters
-
-- `angle` **[number][1]** angle of rotation. (optional, default `auto`)
-- `options` **[Object][2]?** if present, is an Object with optional attributes.
- - `options.background` **([string][3] \| [Object][2])** parsed by the [color][4] module to extract values for red, green, blue and alpha. (optional, default `"#000000"`)
-
-### Examples
-
-```javascript
-const pipeline = sharp()
- .rotate()
- .resize(null, 200)
- .toBuffer(function (err, outputBuffer, info) {
- // outputBuffer contains 200px high JPEG image data,
- // auto-rotated using EXIF Orientation tag
- // info.width and info.height contain the dimensions of the resized image
- });
-readableStream.pipe(pipeline);
-```
-
-- Throws **[Error][5]** Invalid parameters
-
-Returns **Sharp**
-
-## flip
-
-Flip the image about the vertical Y axis. This always occurs after rotation, if any.
-The use of `flip` implies the removal of the EXIF `Orientation` tag, if any.
-
-### Parameters
-
-- `flip` **[Boolean][6]** (optional, default `true`)
-
-Returns **Sharp**
-
-## flop
-
-Flop the image about the horizontal X axis. This always occurs after rotation, if any.
-The use of `flop` implies the removal of the EXIF `Orientation` tag, if any.
-
-### Parameters
-
-- `flop` **[Boolean][6]** (optional, default `true`)
-
-Returns **Sharp**
-
-## affine
-
-Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
-
-You must provide an array of length 4 or a 2x2 affine transformation matrix.
-By default, new pixels are filled with a black background. You can provide a background color with the `background` option.
-A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolator` Object e.g. `sharp.interpolator.nohalo`.
-
-In the case of a 2x2 matrix, the transform is:
-
-- X = `matrix[0, 0]` \* (x + `idx`) + `matrix[0, 1]` \* (y + `idy`) + `odx`
-- Y = `matrix[1, 0]` \* (x + `idx`) + `matrix[1, 1]` \* (y + `idy`) + `ody`
-
-where:
-
-- x and y are the coordinates in input image.
-- X and Y are the coordinates in output image.
-- (0,0) is the upper left corner.
-
-### Parameters
-
-- `matrix` **([Array][7]<[Array][7]<[number][1]>> | [Array][7]<[number][1]>)** affine transformation matrix
-- `options` **[Object][2]?** if present, is an Object with optional attributes.
- - `options.background` **([String][3] \| [Object][2])** parsed by the [color][4] module to extract values for red, green, blue and alpha. (optional, default `"#000000"`)
- - `options.idx` **[Number][1]** input horizontal offset (optional, default `0`)
- - `options.idy` **[Number][1]** input vertical offset (optional, default `0`)
- - `options.odx` **[Number][1]** output horizontal offset (optional, default `0`)
- - `options.ody` **[Number][1]** output vertical offset (optional, default `0`)
- - `options.interpolator` **[String][3]** interpolator (optional, default `sharp.interpolators.bicubic`)
-
-### Examples
-
-```javascript
-const pipeline = sharp()
- .affine([[1, 0.3], [0.1, 0.7]], {
- background: 'white',
- interpolate: sharp.interpolators.nohalo
- })
- .toBuffer((err, outputBuffer, info) => {
- // outputBuffer contains the transformed image
- // info.width and info.height contain the new dimensions
- });
-
-inputStream
- .pipe(pipeline);
-```
-
-- Throws **[Error][5]** Invalid parameters
-
-Returns **Sharp**
-
-**Meta**
-
-- **since**: 0.27.0
-
-## sharpen
-
-Sharpen the image.
-When used without parameters, performs a fast, mild sharpen of the output image.
-When a `sigma` is provided, performs a slower, more accurate sharpen of the L channel in the LAB colour space.
-Separate control over the level of sharpening in "flat" and "jagged" areas is available.
-
-### Parameters
-
-- `sigma` **[number][1]?** the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
-- `flat` **[number][1]** the level of sharpening to apply to "flat" areas. (optional, default `1.0`)
-- `jagged` **[number][1]** the level of sharpening to apply to "jagged" areas. (optional, default `2.0`)
-
-
-- Throws **[Error][5]** Invalid parameters
-
-Returns **Sharp**
-
-## median
-
-Apply median filter.
-When used without parameters the default window is 3x3.
-
-### Parameters
-
-- `size` **[number][1]** square mask size: size x size (optional, default `3`)
-
-
-- Throws **[Error][5]** Invalid parameters
-
-Returns **Sharp**
-
-## blur
-
-Blur the image.
-When used without parameters, performs a fast, mild blur of the output image.
-When a `sigma` is provided, performs a slower, more accurate Gaussian blur.
-
-### Parameters
-
-- `sigma` **[number][1]?** a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
-
-
-- Throws **[Error][5]** Invalid parameters
-
-Returns **Sharp**
-
-## flatten
-
-Merge alpha transparency channel, if any, with a background, then remove the alpha channel.
-
-### Parameters
-
-- `options` **[Object][2]?**
- - `options.background` **([string][3] \| [Object][2])** background colour, parsed by the [color][4] module, defaults to black. (optional, default `{r:0,g:0,b:0}`)
-
-### Examples
-
-```javascript
-await sharp(rgbaInput)
- .flatten('#F0A703')
- .toBuffer();
-```
-
-Returns **Sharp**
-
-## gamma
-
-Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of `1/gamma`
-then increasing the encoding (brighten) post-resize at a factor of `gamma`.
-This can improve the perceived brightness of a resized image in non-linear colour spaces.
-JPEG and WebP input images will not take advantage of the shrink-on-load performance optimisation
-when applying a gamma correction.
-
-Supply a second argument to use a different output gamma value, otherwise the first value is used in both cases.
-
-### Parameters
-
-- `gamma` **[number][1]** value between 1.0 and 3.0. (optional, default `2.2`)
-- `gammaOut` **[number][1]?** value between 1.0 and 3.0. (optional, defaults to same as `gamma`)
-
-
-- Throws **[Error][5]** Invalid parameters
-
-Returns **Sharp**
-
-## negate
-
-Produce the "negative" of the image.
-
-### Parameters
-
-- `negate` **[Boolean][6]** (optional, default `true`)
-
-Returns **Sharp**
-
-## normalise
-
-Enhance output image contrast by stretching its luminance to cover the full dynamic range.
-
-### Parameters
-
-- `normalise` **[Boolean][6]** (optional, default `true`)
-
-Returns **Sharp**
-
-## normalize
-
-Alternative spelling of normalise.
-
-### Parameters
-
-- `normalize` **[Boolean][6]** (optional, default `true`)
-
-Returns **Sharp**
-
-## convolve
-
-Convolve the image with the specified kernel.
-
-### Parameters
-
-- `kernel` **[Object][2]**
- - `kernel.width` **[number][1]** width of the kernel in pixels.
- - `kernel.height` **[number][1]** width of the kernel in pixels.
- - `kernel.kernel` **[Array][7]<[number][1]>** Array of length `width*height` containing the kernel values.
- - `kernel.scale` **[number][1]** the scale of the kernel in pixels. (optional, default `sum`)
- - `kernel.offset` **[number][1]** the offset of the kernel in pixels. (optional, default `0`)
-
-### Examples
-
-```javascript
-sharp(input)
- .convolve({
- width: 3,
- height: 3,
- kernel: [-1, 0, 1, -2, 0, 2, -1, 0, 1]
- })
- .raw()
- .toBuffer(function(err, data, info) {
- // data contains the raw pixel data representing the convolution
- // of the input image with the horizontal Sobel operator
- });
-```
-
-- Throws **[Error][5]** Invalid parameters
-
-Returns **Sharp**
-
-## threshold
-
-Any pixel value greater than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
-
-### Parameters
-
-- `threshold` **[number][1]** a value in the range 0-255 representing the level at which the threshold will be applied. (optional, default `128`)
-- `options` **[Object][2]?**
- - `options.greyscale` **[Boolean][6]** convert to single channel greyscale. (optional, default `true`)
- - `options.grayscale` **[Boolean][6]** alternative spelling for greyscale. (optional, default `true`)
-
-
-- Throws **[Error][5]** Invalid parameters
-
-Returns **Sharp**
-
-## boolean
-
-Perform a bitwise boolean operation with operand image.
-
-This operation creates an output image where each pixel is the result of
-the selected bitwise boolean `operation` between the corresponding pixels of the input images.
-
-### Parameters
-
-- `operand` **([Buffer][8] \| [string][3])** Buffer containing image data or string containing the path to an image file.
-- `operator` **[string][3]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
-- `options` **[Object][2]?**
- - `options.raw` **[Object][2]?** describes operand when using raw pixel data.
- - `options.raw.width` **[number][1]?**
- - `options.raw.height` **[number][1]?**
- - `options.raw.channels` **[number][1]?**
-
-
-- Throws **[Error][5]** Invalid parameters
-
-Returns **Sharp**
-
-## linear
-
-Apply the linear formula a \* input + b to the image (levels adjustment)
-
-### Parameters
-
-- `a` **[number][1]** multiplier (optional, default `1.0`)
-- `b` **[number][1]** offset (optional, default `0.0`)
-
-
-- Throws **[Error][5]** Invalid parameters
-
-Returns **Sharp**
-
-## recomb
-
-Recomb the image with the specified matrix.
-
-### Parameters
-
-- `inputMatrix` **[Array][7]<[Array][7]<[number][1]>>** 3x3 Recombination matrix
-
-### Examples
-
-```javascript
-sharp(input)
- .recomb([
- [0.3588, 0.7044, 0.1368],
- [0.2990, 0.5870, 0.1140],
- [0.2392, 0.4696, 0.0912],
- ])
- .raw()
- .toBuffer(function(err, data, info) {
- // data contains the raw pixel data after applying the recomb
- // With this example input, a sepia filter has been applied
- });
-```
-
-- Throws **[Error][5]** Invalid parameters
-
-Returns **Sharp**
-
-**Meta**
-
-- **since**: 0.21.1
-
-## modulate
-
-Transforms the image using brightness, saturation and hue rotation.
-
-### Parameters
-
-- `options` **[Object][2]?**
- - `options.brightness` **[number][1]?** Brightness multiplier
- - `options.saturation` **[number][1]?** Saturation multiplier
- - `options.hue` **[number][1]?** Degrees for hue rotation
-
-### Examples
-
-```javascript
-sharp(input)
- .modulate({
- brightness: 2 // increase lightness by a factor of 2
- });
-
-sharp(input)
- .modulate({
- hue: 180 // hue-rotate by 180 degrees
- });
-
-// decreate brightness and saturation while also hue-rotating by 90 degrees
-sharp(input)
- .modulate({
- brightness: 0.5,
- saturation: 0.5,
- hue: 90
- });
-```
-
-Returns **Sharp**
-
-**Meta**
-
-- **since**: 0.22.1
-
-[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
-
-[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
-
-[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
-
-[4]: https://www.npmjs.org/package/color
-
-[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
-
-[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
-
-[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
-
-[8]: https://nodejs.org/api/buffer.html
diff --git a/docs/api-output.md b/docs/api-output.md
deleted file mode 100644
index eb2cd8b86..000000000
--- a/docs/api-output.md
+++ /dev/null
@@ -1,470 +0,0 @@
-
-
-## toFile
-
-Write output image data to a file.
-
-If an explicit output format is not selected, it will be inferred from the extension,
-with JPEG, PNG, WebP, AVIF, TIFF, DZI, and libvips' V format supported.
-Note that raw pixel data is only supported for buffer output.
-
-By default all metadata will be removed, which includes EXIF-based orientation.
-See [withMetadata][1] for control over this.
-
-A `Promise` is returned when `callback` is not provided.
-
-### Parameters
-
-- `fileOut` **[string][2]** the path to write the image data to.
-- `callback` **[Function][3]?** called on completion with two arguments `(err, info)`.
- `info` contains the output image `format`, `size` (bytes), `width`, `height`,
- `channels` and `premultiplied` (indicating if premultiplication was used).
- When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
-
-### Examples
-
-```javascript
-sharp(input)
- .toFile('output.png', (err, info) => { ... });
-```
-
-```javascript
-sharp(input)
- .toFile('output.png')
- .then(info => { ... })
- .catch(err => { ... });
-```
-
-- Throws **[Error][4]** Invalid parameters
-
-Returns **[Promise][5]<[Object][6]>** when no callback is provided
-
-## toBuffer
-
-Write output to a Buffer.
-JPEG, PNG, WebP, AVIF, TIFF and raw pixel data output are supported.
-
-If no explicit format is set, the output format will match the input image, except GIF and SVG input which become PNG output.
-
-By default all metadata will be removed, which includes EXIF-based orientation.
-See [withMetadata][1] for control over this.
-
-`callback`, if present, gets three arguments `(err, data, info)` where:
-
-- `err` is an error, if any.
-- `data` is the output image data.
-- `info` contains the output image `format`, `size` (bytes), `width`, `height`,
- `channels` and `premultiplied` (indicating if premultiplication was used).
- When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
-
-A `Promise` is returned when `callback` is not provided.
-
-### Parameters
-
-- `options` **[Object][6]?**
- - `options.resolveWithObject` **[boolean][7]?** Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`.
-- `callback` **[Function][3]?**
-
-### Examples
-
-```javascript
-sharp(input)
- .toBuffer((err, data, info) => { ... });
-```
-
-```javascript
-sharp(input)
- .toBuffer()
- .then(data => { ... })
- .catch(err => { ... });
-```
-
-```javascript
-sharp(input)
- .toBuffer({ resolveWithObject: true })
- .then(({ data, info }) => { ... })
- .catch(err => { ... });
-```
-
-```javascript
-const { data, info } = await sharp('my-image.jpg')
- // output the raw pixels
- .raw()
- .toBuffer({ resolveWithObject: true });
-
-// create a more type safe way to work with the raw pixel data
-// this will not copy the data, instead it will change `data`s underlying ArrayBuffer
-// so `data` and `pixelArray` point to the same memory location
-const pixelArray = new Uint8ClampedArray(data.buffer);
-
-// When you are done changing the pixelArray, sharp takes the `pixelArray` as an input
-const { width, height, channels } = info;
-await sharp(pixelArray, { raw: { width, height, channels } })
- .toFile('my-changed-image.jpg');
-```
-
-Returns **[Promise][5]<[Buffer][8]>** when no callback is provided
-
-## withMetadata
-
-Include all metadata (EXIF, XMP, IPTC) from the input image in the output image.
-This will also convert to and add a web-friendly sRGB ICC profile unless a custom
-output profile is provided.
-
-The default behaviour, when `withMetadata` is not used, is to convert to the device-independent
-sRGB colour space and strip all metadata, including the removal of any ICC profile.
-
-### Parameters
-
-- `options` **[Object][6]?**
- - `options.orientation` **[number][9]?** value between 1 and 8, used to update the EXIF `Orientation` tag.
- - `options.icc` **[string][2]?** filesystem path to output ICC profile, defaults to sRGB.
-
-### Examples
-
-```javascript
-sharp('input.jpg')
- .withMetadata()
- .toFile('output-with-metadata.jpg')
- .then(info => { ... });
-```
-
-- Throws **[Error][4]** Invalid parameters
-
-Returns **Sharp**
-
-## toFormat
-
-Force output to a given format.
-
-### Parameters
-
-- `format` **([string][2] \| [Object][6])** as a string or an Object with an 'id' attribute
-- `options` **[Object][6]** output options
-
-### Examples
-
-```javascript
-// Convert any input to PNG output
-const data = await sharp(input)
- .toFormat('png')
- .toBuffer();
-```
-
-- Throws **[Error][4]** unsupported format or options
-
-Returns **Sharp**
-
-## jpeg
-
-Use these JPEG options for output image.
-
-### Parameters
-
-- `options` **[Object][6]?** output options
- - `options.quality` **[number][9]** quality, integer 1-100 (optional, default `80`)
- - `options.progressive` **[boolean][7]** use progressive (interlace) scan (optional, default `false`)
- - `options.chromaSubsampling` **[string][2]** set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling (optional, default `'4:2:0'`)
- - `options.optimiseCoding` **[boolean][7]** optimise Huffman coding tables (optional, default `true`)
- - `options.optimizeCoding` **[boolean][7]** alternative spelling of optimiseCoding (optional, default `true`)
- - `options.mozjpeg` **[boolean][7]** use mozjpeg defaults, equivalent to `{ trellisQuantisation: true, overshootDeringing: true, optimiseScans: true, quantisationTable: 3 }` (optional, default `false`)
- - `options.trellisQuantisation` **[boolean][7]** apply trellis quantisation (optional, default `false`)
- - `options.overshootDeringing` **[boolean][7]** apply overshoot deringing (optional, default `false`)
- - `options.optimiseScans` **[boolean][7]** optimise progressive scans, forces progressive (optional, default `false`)
- - `options.optimizeScans` **[boolean][7]** alternative spelling of optimiseScans (optional, default `false`)
- - `options.quantisationTable` **[number][9]** quantization table to use, integer 0-8 (optional, default `0`)
- - `options.quantizationTable` **[number][9]** alternative spelling of quantisationTable (optional, default `0`)
- - `options.force` **[boolean][7]** force JPEG output, otherwise attempt to use input format (optional, default `true`)
-
-### Examples
-
-```javascript
-// Convert any input to very high quality JPEG output
-const data = await sharp(input)
- .jpeg({
- quality: 100,
- chromaSubsampling: '4:4:4'
- })
- .toBuffer();
-```
-
-```javascript
-// Use mozjpeg to reduce output JPEG file size (slower)
-const data = await sharp(input)
- .jpeg({ mozjpeg: true })
- .toBuffer();
-```
-
-- Throws **[Error][4]** Invalid options
-
-Returns **Sharp**
-
-## png
-
-Use these PNG options for output image.
-
-By default, PNG output is full colour at 8 or 16 bits per pixel.
-Indexed PNG input at 1, 2 or 4 bits per pixel is converted to 8 bits per pixel.
-Set `palette` to `true` for slower, indexed PNG output.
-
-### Parameters
-
-- `options` **[Object][6]?**
- - `options.progressive` **[boolean][7]** use progressive (interlace) scan (optional, default `false`)
- - `options.compressionLevel` **[number][9]** zlib compression level, 0 (fastest, largest) to 9 (slowest, smallest) (optional, default `6`)
- - `options.adaptiveFiltering` **[boolean][7]** use adaptive row filtering (optional, default `false`)
- - `options.palette` **[boolean][7]** quantise to a palette-based image with alpha transparency support (optional, default `false`)
- - `options.quality` **[number][9]** use the lowest number of colours needed to achieve given quality, sets `palette` to `true` (optional, default `100`)
- - `options.colours` **[number][9]** maximum number of palette entries, sets `palette` to `true` (optional, default `256`)
- - `options.colors` **[number][9]** alternative spelling of `options.colours`, sets `palette` to `true` (optional, default `256`)
- - `options.dither` **[number][9]** level of Floyd-Steinberg error diffusion, sets `palette` to `true` (optional, default `1.0`)
- - `options.force` **[boolean][7]** force PNG output, otherwise attempt to use input format (optional, default `true`)
-
-### Examples
-
-```javascript
-// Convert any input to full colour PNG output
-const data = await sharp(input)
- .png()
- .toBuffer();
-```
-
-```javascript
-// Convert any input to indexed PNG output (slower)
-const data = await sharp(input)
- .png({ palette: true })
- .toBuffer();
-```
-
-- Throws **[Error][4]** Invalid options
-
-Returns **Sharp**
-
-## webp
-
-Use these WebP options for output image.
-
-### Parameters
-
-- `options` **[Object][6]?** output options
- - `options.quality` **[number][9]** quality, integer 1-100 (optional, default `80`)
- - `options.alphaQuality` **[number][9]** quality of alpha layer, integer 0-100 (optional, default `100`)
- - `options.lossless` **[boolean][7]** use lossless compression mode (optional, default `false`)
- - `options.nearLossless` **[boolean][7]** use near_lossless compression mode (optional, default `false`)
- - `options.smartSubsample` **[boolean][7]** use high quality chroma subsampling (optional, default `false`)
- - `options.reductionEffort` **[number][9]** level of CPU effort to reduce file size, integer 0-6 (optional, default `4`)
- - `options.pageHeight` **[number][9]?** page height for animated output
- - `options.loop` **[number][9]** number of animation iterations, use 0 for infinite animation (optional, default `0`)
- - `options.delay` **[Array][10]<[number][9]>?** list of delays between animation frames (in milliseconds)
- - `options.force` **[boolean][7]** force WebP output, otherwise attempt to use input format (optional, default `true`)
-
-### Examples
-
-```javascript
-// Convert any input to lossless WebP output
-const data = await sharp(input)
- .webp({ lossless: true })
- .toBuffer();
-```
-
-- Throws **[Error][4]** Invalid options
-
-Returns **Sharp**
-
-## gif
-
-Use these GIF options for output image.
-
-Requires libvips compiled with support for ImageMagick or GraphicsMagick.
-The prebuilt binaries do not include this - see
-[installing a custom libvips][11].
-
-### Parameters
-
-- `options` **[Object][6]?** output options
- - `options.pageHeight` **[number][9]?** page height for animated output
- - `options.loop` **[number][9]** number of animation iterations, use 0 for infinite animation (optional, default `0`)
- - `options.delay` **[Array][10]<[number][9]>?** list of delays between animation frames (in milliseconds)
- - `options.force` **[boolean][7]** force GIF output, otherwise attempt to use input format (optional, default `true`)
-
-
-- Throws **[Error][4]** Invalid options
-
-Returns **Sharp**
-
-## tiff
-
-Use these TIFF options for output image.
-
-### Parameters
-
-- `options` **[Object][6]?** output options
- - `options.quality` **[number][9]** quality, integer 1-100 (optional, default `80`)
- - `options.force` **[boolean][7]** force TIFF output, otherwise attempt to use input format (optional, default `true`)
- - `options.compression` **[string][2]** compression options: lzw, deflate, jpeg, ccittfax4 (optional, default `'jpeg'`)
- - `options.predictor` **[string][2]** compression predictor options: none, horizontal, float (optional, default `'horizontal'`)
- - `options.pyramid` **[boolean][7]** write an image pyramid (optional, default `false`)
- - `options.tile` **[boolean][7]** write a tiled tiff (optional, default `false`)
- - `options.tileWidth` **[number][9]** horizontal tile size (optional, default `256`)
- - `options.tileHeight` **[number][9]** vertical tile size (optional, default `256`)
- - `options.xres` **[number][9]** horizontal resolution in pixels/mm (optional, default `1.0`)
- - `options.yres` **[number][9]** vertical resolution in pixels/mm (optional, default `1.0`)
- - `options.bitdepth` **[number][9]** reduce bitdepth to 1, 2 or 4 bit (optional, default `8`)
-
-### Examples
-
-```javascript
-// Convert SVG input to LZW-compressed, 1 bit per pixel TIFF output
-sharp('input.svg')
- .tiff({
- compression: 'lzw',
- bitdepth: 1
- })
- .toFile('1-bpp-output.tiff')
- .then(info => { ... });
-```
-
-- Throws **[Error][4]** Invalid options
-
-Returns **Sharp**
-
-## avif
-
-Use these AVIF options for output image.
-
-Whilst it is possible to create AVIF images smaller than 16x16 pixels,
-most web browsers do not display these properly.
-
-### Parameters
-
-- `options` **[Object][6]?** output options
- - `options.quality` **[number][9]** quality, integer 1-100 (optional, default `50`)
- - `options.lossless` **[boolean][7]** use lossless compression (optional, default `false`)
- - `options.speed` **[number][9]** CPU effort vs file size, 0 (slowest/smallest) to 8 (fastest/largest) (optional, default `5`)
- - `options.chromaSubsampling` **[string][2]** set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling, requires libvips v8.11.0 (optional, default `'4:2:0'`)
-
-
-- Throws **[Error][4]** Invalid options
-
-Returns **Sharp**
-
-**Meta**
-
-- **since**: 0.27.0
-
-## heif
-
-Use these HEIF options for output image.
-
-Support for patent-encumbered HEIC images requires the use of a
-globally-installed libvips compiled with support for libheif, libde265 and x265.
-
-### Parameters
-
-- `options` **[Object][6]?** output options
- - `options.quality` **[number][9]** quality, integer 1-100 (optional, default `50`)
- - `options.compression` **[string][2]** compression format: av1, hevc (optional, default `'av1'`)
- - `options.lossless` **[boolean][7]** use lossless compression (optional, default `false`)
- - `options.speed` **[number][9]** CPU effort vs file size, 0 (slowest/smallest) to 8 (fastest/largest) (optional, default `5`)
- - `options.chromaSubsampling` **[string][2]** set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling, requires libvips v8.11.0 (optional, default `'4:2:0'`)
-
-
-- Throws **[Error][4]** Invalid options
-
-Returns **Sharp**
-
-**Meta**
-
-- **since**: 0.23.0
-
-## raw
-
-Force output to be raw, uncompressed, 8-bit unsigned integer (unit8) pixel data.
-Pixel ordering is left-to-right, top-to-bottom, without padding.
-Channel ordering will be RGB or RGBA for non-greyscale colourspaces.
-
-### Examples
-
-```javascript
-// Extract raw RGB pixel data from JPEG input
-const { data, info } = await sharp('input.jpg')
- .raw()
- .toBuffer({ resolveWithObject: true });
-```
-
-```javascript
-// Extract alpha channel as raw pixel data from PNG input
-const data = await sharp('input.png')
- .ensureAlpha()
- .extractChannel(3)
- .toColourspace('b-w')
- .raw()
- .toBuffer();
-```
-
-Returns **Sharp**
-
-## tile
-
-Use tile-based deep zoom (image pyramid) output.
-Set the format and options for tile images via the `toFormat`, `jpeg`, `png` or `webp` functions.
-Use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
-
-Warning: multiple sharp instances concurrently producing tile output can expose a possible race condition in some versions of libgsf.
-
-### Parameters
-
-- `options` **[Object][6]?**
- - `options.size` **[number][9]** tile size in pixels, a value between 1 and 8192. (optional, default `256`)
- - `options.overlap` **[number][9]** tile overlap in pixels, a value between 0 and 8192. (optional, default `0`)
- - `options.angle` **[number][9]** tile angle of rotation, must be a multiple of 90. (optional, default `0`)
- - `options.background` **([string][2] \| [Object][6])** background colour, parsed by the [color][12] module, defaults to white without transparency. (optional, default `{r:255,g:255,b:255,alpha:1}`)
- - `options.depth` **[string][2]?** how deep to make the pyramid, possible values are `onepixel`, `onetile` or `one`, default based on layout.
- - `options.skipBlanks` **[number][9]** threshold to skip tile generation, a value 0 - 255 for 8-bit images or 0 - 65535 for 16-bit images (optional, default `-1`)
- - `options.container` **[string][2]** tile container, with value `fs` (filesystem) or `zip` (compressed file). (optional, default `'fs'`)
- - `options.layout` **[string][2]** filesystem layout, possible values are `dz`, `iiif`, `zoomify` or `google`. (optional, default `'dz'`)
- - `options.centre` **[boolean][7]** centre image in tile. (optional, default `false`)
- - `options.center` **[boolean][7]** alternative spelling of centre. (optional, default `false`)
- - `options.id` **[string][2]** when `layout` is `iiif`, sets the `@id` attribute of `info.json` (optional, default `'https://example.com/iiif'`)
-
-### Examples
-
-```javascript
-sharp('input.tiff')
- .png()
- .tile({
- size: 512
- })
- .toFile('output.dz', function(err, info) {
- // output.dzi is the Deep Zoom XML definition
- // output_files contains 512x512 tiles grouped by zoom level
- });
-```
-
-- Throws **[Error][4]** Invalid parameters
-
-Returns **Sharp**
-
-[1]: #withmetadata
-
-[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
-
-[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
-
-[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
-
-[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
-
-[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
-
-[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
-
-[8]: https://nodejs.org/api/buffer.html
-
-[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
-
-[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
-
-[11]: https://sharp.pixelplumbing.com/install#custom-libvips
-
-[12]: https://www.npmjs.org/package/color
diff --git a/docs/api-resize.md b/docs/api-resize.md
deleted file mode 100644
index 5fac17f02..000000000
--- a/docs/api-resize.md
+++ /dev/null
@@ -1,258 +0,0 @@
-
-
-## resize
-
-Resize image to `width`, `height` or `width x height`.
-
-When both a `width` and `height` are provided, the possible methods by which the image should **fit** these are:
-
-- `cover`: (default) Preserving aspect ratio, ensure the image covers both provided dimensions by cropping/clipping to fit.
-- `contain`: Preserving aspect ratio, contain within both provided dimensions using "letterboxing" where necessary.
-- `fill`: Ignore the aspect ratio of the input and stretch to both provided dimensions.
-- `inside`: Preserving aspect ratio, resize the image to be as large as possible while ensuring its dimensions are less than or equal to both those specified.
-- `outside`: Preserving aspect ratio, resize the image to be as small as possible while ensuring its dimensions are greater than or equal to both those specified.
-
-Some of these values are based on the [object-fit][1] CSS property.
-
-When using a `fit` of `cover` or `contain`, the default **position** is `centre`. Other options are:
-
-- `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`.
-- `sharp.gravity`: `north`, `northeast`, `east`, `southeast`, `south`, `southwest`, `west`, `northwest`, `center` or `centre`.
-- `sharp.strategy`: `cover` only, dynamically crop using either the `entropy` or `attention` strategy.
-
-Some of these values are based on the [object-position][2] CSS property.
-
-The experimental strategy-based approach resizes so one dimension is at its target length
-then repeatedly ranks edge regions, discarding the edge with the lowest score based on the selected strategy.
-
-- `entropy`: focus on the region with the highest [Shannon entropy][3].
-- `attention`: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.
-
-Possible interpolation kernels are:
-
-- `nearest`: Use [nearest neighbour interpolation][4].
-- `cubic`: Use a [Catmull-Rom spline][5].
-- `mitchell`: Use a [Mitchell-Netravali spline][6].
-- `lanczos2`: Use a [Lanczos kernel][7] with `a=2`.
-- `lanczos3`: Use a Lanczos kernel with `a=3` (the default).
-
-### Parameters
-
-- `width` **[number][8]?** pixels wide the resultant image should be. Use `null` or `undefined` to auto-scale the width to match the height.
-- `height` **[number][8]?** pixels high the resultant image should be. Use `null` or `undefined` to auto-scale the height to match the width.
-- `options` **[Object][9]?**
- - `options.width` **[String][10]?** alternative means of specifying `width`. If both are present this take priority.
- - `options.height` **[String][10]?** alternative means of specifying `height`. If both are present this take priority.
- - `options.fit` **[String][10]** how the image should be resized to fit both provided dimensions, one of `cover`, `contain`, `fill`, `inside` or `outside`. (optional, default `'cover'`)
- - `options.position` **[String][10]** position, gravity or strategy to use when `fit` is `cover` or `contain`. (optional, default `'centre'`)
- - `options.background` **([String][10] \| [Object][9])** background colour when using a `fit` of `contain`, parsed by the [color][11] module, defaults to black without transparency. (optional, default `{r:0,g:0,b:0,alpha:1}`)
- - `options.kernel` **[String][10]** the kernel to use for image reduction. (optional, default `'lanczos3'`)
- - `options.withoutEnlargement` **[Boolean][12]** do not enlarge if the width _or_ height are already less than the specified dimensions, equivalent to GraphicsMagick's `>` geometry option. (optional, default `false`)
- - `options.fastShrinkOnLoad` **[Boolean][12]** take greater advantage of the JPEG and WebP shrink-on-load feature, which can lead to a slight moiré pattern on some images. (optional, default `true`)
-
-### Examples
-
-```javascript
-sharp(input)
- .resize({ width: 100 })
- .toBuffer()
- .then(data => {
- // 100 pixels wide, auto-scaled height
- });
-```
-
-```javascript
-sharp(input)
- .resize({ height: 100 })
- .toBuffer()
- .then(data => {
- // 100 pixels high, auto-scaled width
- });
-```
-
-```javascript
-sharp(input)
- .resize(200, 300, {
- kernel: sharp.kernel.nearest,
- fit: 'contain',
- position: 'right top',
- background: { r: 255, g: 255, b: 255, alpha: 0.5 }
- })
- .toFile('output.png')
- .then(() => {
- // output.png is a 200 pixels wide and 300 pixels high image
- // containing a nearest-neighbour scaled version
- // contained within the north-east corner of a semi-transparent white canvas
- });
-```
-
-```javascript
-const transformer = sharp()
- .resize({
- width: 200,
- height: 200,
- fit: sharp.fit.cover,
- position: sharp.strategy.entropy
- });
-// Read image data from readableStream
-// Write 200px square auto-cropped image data to writableStream
-readableStream
- .pipe(transformer)
- .pipe(writableStream);
-```
-
-```javascript
-sharp(input)
- .resize(200, 200, {
- fit: sharp.fit.inside,
- withoutEnlargement: true
- })
- .toFormat('jpeg')
- .toBuffer()
- .then(function(outputBuffer) {
- // outputBuffer contains JPEG image data
- // no wider and no higher than 200 pixels
- // and no larger than the input image
- });
-```
-
-```javascript
-const scaleByHalf = await sharp(input)
- .metadata()
- .then(({ width }) => sharp(input)
- .resize(Math.round(width * 0.5))
- .toBuffer()
- );
-```
-
-- Throws **[Error][13]** Invalid parameters
-
-Returns **Sharp**
-
-## extend
-
-Extends/pads the edges of the image with the provided background colour.
-This operation will always occur after resizing and extraction, if any.
-
-### Parameters
-
-- `extend` **([number][8] \| [Object][9])** single pixel count to add to all edges or an Object with per-edge counts
- - `extend.top` **[number][8]** (optional, default `0`)
- - `extend.left` **[number][8]** (optional, default `0`)
- - `extend.bottom` **[number][8]** (optional, default `0`)
- - `extend.right` **[number][8]** (optional, default `0`)
- - `extend.background` **([String][10] \| [Object][9])** background colour, parsed by the [color][11] module, defaults to black without transparency. (optional, default `{r:0,g:0,b:0,alpha:1}`)
-
-### Examples
-
-```javascript
-// Resize to 140 pixels wide, then add 10 transparent pixels
-// to the top, left and right edges and 20 to the bottom edge
-sharp(input)
- .resize(140)
- .extend({
- top: 10,
- bottom: 20,
- left: 10,
- right: 10,
- background: { r: 0, g: 0, b: 0, alpha: 0 }
- })
- ...
-```
-
-```javascript
-// Add a row of 10 red pixels to the bottom
-sharp(input)
- .extend({
- bottom: 10,
- background: 'red'
- })
- ...
-```
-
-- Throws **[Error][13]** Invalid parameters
-
-Returns **Sharp**
-
-## extract
-
-Extract/crop a region of the image.
-
-- Use `extract` before `resize` for pre-resize extraction.
-- Use `extract` after `resize` for post-resize extraction.
-- Use `extract` before and after for both.
-
-### Parameters
-
-- `options` **[Object][9]** describes the region to extract using integral pixel values
- - `options.left` **[number][8]** zero-indexed offset from left edge
- - `options.top` **[number][8]** zero-indexed offset from top edge
- - `options.width` **[number][8]** width of region to extract
- - `options.height` **[number][8]** height of region to extract
-
-### Examples
-
-```javascript
-sharp(input)
- .extract({ left: left, top: top, width: width, height: height })
- .toFile(output, function(err) {
- // Extract a region of the input image, saving in the same format.
- });
-```
-
-```javascript
-sharp(input)
- .extract({ left: leftOffsetPre, top: topOffsetPre, width: widthPre, height: heightPre })
- .resize(width, height)
- .extract({ left: leftOffsetPost, top: topOffsetPost, width: widthPost, height: heightPost })
- .toFile(output, function(err) {
- // Extract a region, resize, then extract from the resized image
- });
-```
-
-- Throws **[Error][13]** Invalid parameters
-
-Returns **Sharp**
-
-## trim
-
-Trim "boring" pixels from all edges that contain values similar to the top-left pixel.
-Images consisting entirely of a single colour will calculate "boring" using the alpha channel, if any.
-
-The `info` response Object, obtained from callback of `.toFile()` or `.toBuffer()`,
-will contain `trimOffsetLeft` and `trimOffsetTop` properties.
-
-### Parameters
-
-- `threshold` **[number][8]** the allowed difference from the top-left pixel, a number greater than zero. (optional, default `10`)
-
-
-- Throws **[Error][13]** Invalid parameters
-
-Returns **Sharp**
-
-[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
-
-[2]: https://developer.mozilla.org/en-US/docs/Web/CSS/object-position
-
-[3]: https://en.wikipedia.org/wiki/Entropy_%28information_theory%29
-
-[4]: http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation
-
-[5]: https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline
-
-[6]: https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf
-
-[7]: https://en.wikipedia.org/wiki/Lanczos_resampling#Lanczos_kernel
-
-[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
-
-[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
-
-[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
-
-[11]: https://www.npmjs.org/package/color
-
-[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
-
-[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
diff --git a/docs/api-utility.md b/docs/api-utility.md
deleted file mode 100644
index 01a0bd3c8..000000000
--- a/docs/api-utility.md
+++ /dev/null
@@ -1,189 +0,0 @@
-
-
-## format
-
-An Object containing nested boolean values representing the available input and output formats/methods.
-
-### Examples
-
-```javascript
-console.log(sharp.format);
-```
-
-Returns **[Object][1]**
-
-## interpolators
-
-An Object containing the available interpolators and their proper values
-
-Type: [string][2]
-
-### nearest
-
-[Nearest neighbour interpolation][3]. Suitable for image enlargement only.
-
-### bilinear
-
-[Bilinear interpolation][4]. Faster than bicubic but with less smooth results.
-
-### bicubic
-
-[Bicubic interpolation][5] (the default).
-
-### locallyBoundedBicubic
-
-[LBB interpolation][6]. Prevents some "[acutance][7]" but typically reduces performance by a factor of 2.
-
-### nohalo
-
-[Nohalo interpolation][8]. Prevents acutance but typically reduces performance by a factor of 3.
-
-### vertexSplitQuadraticBasisSpline
-
-[VSQBS interpolation][9]. Prevents "staircasing" when enlarging.
-
-## versions
-
-An Object containing the version numbers of libvips and its dependencies.
-
-### Examples
-
-```javascript
-console.log(sharp.versions);
-```
-
-## cache
-
-Gets or, when options are provided, sets the limits of _libvips'_ operation cache.
-Existing entries in the cache will be trimmed after any change in limits.
-This method always returns cache statistics,
-useful for determining how much working memory is required for a particular task.
-
-### Parameters
-
-- `options` **([Object][1] \| [boolean][10])** Object with the following attributes, or boolean where true uses default cache settings and false removes all caching (optional, default `true`)
- - `options.memory` **[number][11]** is the maximum memory in MB to use for this cache (optional, default `50`)
- - `options.files` **[number][11]** is the maximum number of files to hold open (optional, default `20`)
- - `options.items` **[number][11]** is the maximum number of operations to cache (optional, default `100`)
-
-### Examples
-
-```javascript
-const stats = sharp.cache();
-```
-
-```javascript
-sharp.cache( { items: 200 } );
-sharp.cache( { files: 0 } );
-sharp.cache(false);
-```
-
-Returns **[Object][1]**
-
-## concurrency
-
-Gets or, when a concurrency is provided, sets
-the number of threads _libvips'_ should create to process each image.
-
-The default value is the number of CPU cores,
-except when using glibc-based Linux without jemalloc,
-where the default is `1` to help reduce memory fragmentation.
-
-A value of `0` will reset this to the number of CPU cores.
-
-The maximum number of images that can be processed in parallel
-is limited by libuv's `UV_THREADPOOL_SIZE` environment variable.
-
-This method always returns the current concurrency.
-
-### Parameters
-
-- `concurrency` **[number][11]?**
-
-### Examples
-
-```javascript
-const threads = sharp.concurrency(); // 4
-sharp.concurrency(2); // 2
-sharp.concurrency(0); // 4
-```
-
-Returns **[number][11]** concurrency
-
-## queue
-
-An EventEmitter that emits a `change` event when a task is either:
-
-- queued, waiting for _libuv_ to provide a worker thread
-- complete
-
-### Examples
-
-```javascript
-sharp.queue.on('change', function(queueLength) {
- console.log('Queue contains ' + queueLength + ' task(s)');
-});
-```
-
-## counters
-
-Provides access to internal task counters.
-
-- queue is the number of tasks this module has queued waiting for _libuv_ to provide a worker thread from its pool.
-- process is the number of resize tasks currently being processed.
-
-### Examples
-
-```javascript
-const counters = sharp.counters(); // { queue: 2, process: 4 }
-```
-
-Returns **[Object][1]**
-
-## simd
-
-Get and set use of SIMD vector unit instructions.
-Requires libvips to have been compiled with liborc support.
-
-Improves the performance of `resize`, `blur` and `sharpen` operations
-by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
-
-### Parameters
-
-- `simd` **[boolean][10]** (optional, default `true`)
-
-### Examples
-
-```javascript
-const simd = sharp.simd();
-// simd is `true` if the runtime use of liborc is currently enabled
-```
-
-```javascript
-const simd = sharp.simd(false);
-// prevent libvips from using liborc at runtime
-```
-
-Returns **[boolean][10]**
-
-[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
-
-[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
-
-[3]: http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation
-
-[4]: http://en.wikipedia.org/wiki/Bilinear_interpolation
-
-[5]: http://en.wikipedia.org/wiki/Bicubic_interpolation
-
-[6]: https://github.com/jcupitt/libvips/blob/master/libvips/resample/lbb.cpp#L100
-
-[7]: http://en.wikipedia.org/wiki/Acutance
-
-[8]: http://eprints.soton.ac.uk/268086/
-
-[9]: https://github.com/jcupitt/libvips/blob/master/libvips/resample/vsqbs.cpp#L48
-
-[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
-
-[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs
new file mode 100644
index 000000000..2209c3381
--- /dev/null
+++ b/docs/astro.config.mjs
@@ -0,0 +1,90 @@
+// @ts-check
+import starlight from '@astrojs/starlight';
+import { defineConfig } from 'astro/config';
+import starlightAutoSidebar from 'starlight-auto-sidebar';
+
+import { version } from '../package.json';
+
+export default defineConfig({
+ site: 'https://sharp.pixelplumbing.com',
+ integrations: [
+ starlight({
+ title: 'sharp',
+ description:
+ 'High performance Node.js image processing. The fastest module to resize JPEG, PNG, WebP and TIFF images.',
+ logo: {
+ src: './src/assets/sharp-logo.svg',
+ alt: '#'
+ },
+ customCss: ['./src/styles/custom.css'],
+ head: [{
+ tag: 'meta',
+ attrs: {
+ 'http-equiv': 'Content-Security-Policy',
+ content: "default-src 'self'; connect-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://static.cloudflareinsights.com/beacon.min.js/;"
+ }
+ }, {
+ tag: 'link',
+ attrs: {
+ rel: 'author',
+ href: '/humans.txt',
+ type: 'text/plain'
+ }
+ }, {
+ tag: 'script',
+ attrs: {
+ type: 'application/ld+json'
+ },
+ content: JSON.stringify({
+ '@context': 'https://schema.org',
+ '@type': 'SoftwareSourceCode',
+ name: 'sharp',
+ description: 'High performance Node.js image processing',
+ url: 'https://sharp.pixelplumbing.com',
+ codeRepository: 'https://github.com/lovell/sharp',
+ programmingLanguage: ['JavaScript', 'C++'],
+ runtimePlatform: 'Node.js',
+ copyrightHolder: {
+ '@context': 'https://schema.org',
+ '@type': 'Person',
+ name: 'Lovell Fuller'
+ },
+ copyrightYear: 2013,
+ license: 'https://www.apache.org/licenses/LICENSE-2.0'
+ })
+ }],
+ sidebar: [
+ { label: 'Home', link: '/' },
+ { label: 'Installation', slug: 'install' },
+ {
+ label: 'API',
+ items: [
+ { label: 'Constructor', slug: 'api-constructor' },
+ { label: 'Input metadata', slug: 'api-input' },
+ { label: 'Output options', slug: 'api-output' },
+ { label: 'Resizing images', slug: 'api-resize' },
+ { label: 'Compositing images', slug: 'api-composite' },
+ { label: 'Image operations', slug: 'api-operation' },
+ { label: 'Colour manipulation', slug: 'api-colour' },
+ { label: 'Channel manipulation', slug: 'api-channel' },
+ { label: 'Global properties', slug: 'api-utility' }
+ ]
+ },
+ { label: 'Performance', slug: 'performance' },
+ {
+ label: 'Changelog',
+ collapsed: true,
+ autogenerate: { directory: 'changelog' }
+ }
+ ],
+ social: [
+ { icon: 'openCollective', label: 'Open Collective', href: 'https://opencollective.com/libvips' },
+ { icon: 'github', label: 'GitHub', href: 'https://github.com/lovell/sharp' }
+ ],
+ plugins: [starlightAutoSidebar()]
+ })
+ ],
+ redirects: {
+ '/changelog': `/changelog/v${version}`
+ }
+});
diff --git a/docs/build.js b/docs/build.js
deleted file mode 100644
index 325138dfb..000000000
--- a/docs/build.js
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict';
-
-const fs = require('fs').promises;
-const path = require('path');
-const documentation = require('documentation');
-
-[
- 'constructor',
- 'input',
- 'resize',
- 'composite',
- 'operation',
- 'colour',
- 'channel',
- 'output',
- 'utility'
-].forEach(async (m) => {
- const input = path.join('lib', `${m}.js`);
- const output = path.join('docs', `api-${m}.md`);
-
- const ast = await documentation.build(input, { shallow: true });
- const markdown = await documentation.formats.md(ast, { markdownToc: false });
-
- await fs.writeFile(output, markdown);
-});
diff --git a/docs/build.mjs b/docs/build.mjs
new file mode 100644
index 000000000..da43a5bf5
--- /dev/null
+++ b/docs/build.mjs
@@ -0,0 +1,42 @@
+/*!
+ Copyright 2013 Lovell Fuller and others.
+ SPDX-License-Identifier: Apache-2.0
+*/
+
+import fs from 'node:fs/promises';
+import path from 'node:path';
+import jsdoc2md from 'jsdoc-to-markdown';
+
+const pages = {
+ constructor: 'Constructor',
+ input: 'Input metadata',
+ resize: 'Resizing images',
+ composite: 'Compositing images',
+ operation: 'Image operations',
+ colour: 'Colour manipulation',
+ channel: 'Channel manipulation',
+ output: 'Output options',
+ utility: 'Global properties'
+};
+
+Object.keys(pages).forEach(async (m) => {
+ const input = path.join('lib', `${m}.js`);
+ const output = path.join('docs', 'src', 'content', 'docs', `api-${m}.md`);
+
+ const ast = await jsdoc2md.getTemplateData({ files: input });
+ const markdown = await jsdoc2md.render({
+ data: ast,
+ 'global-index-format': 'none',
+ 'module-index-format': 'none'
+ });
+
+ const cleanMarkdown =
+ `---\n# This file was auto-generated from JSDoc in lib/${m}.js\ntitle: ${pages[m]}\n---\n\n` +
+ markdown
+ .replace(/(## )([A-Za-z0-9]+)([^\n]*)/g, '$1$2\n> $2$3\n') // simplify headings
+ .replace(/<\/a>/g, '') // remove anchors
+ .replace(/\*\*Kind\*\*: global[^\n]+/g, '') // remove all "global" Kind labels (requires JSDoc refactoring)
+ .trim();
+
+ await fs.writeFile(output, cleanMarkdown);
+});
diff --git a/docs/changelog.md b/docs/changelog.md
deleted file mode 100644
index b87ea5e46..000000000
--- a/docs/changelog.md
+++ /dev/null
@@ -1,1310 +0,0 @@
-# Changelog
-
-## v0.28 - *bijou*
-
-Requires libvips v8.10.6
-
-### v0.28.0 - 29th March 2021
-
-* Prebuilt binaries now include mozjpeg and libimagequant (BSD 2-Clause).
-
-* Prebuilt binaries limit AVIF support to the most common 8-bit depth.
-
-* Add `mozjpeg` option to `jpeg` method, sets mozjpeg defaults.
-
-* Reduce the default PNG `compressionLevel` to the more commonly used 6.
-
-* Reduce concurrency on glibc-based Linux when using the default memory allocator to help prevent fragmentation.
-
-* Default missing edge properties of extend operation to zero.
- [#2578](https://github.com/lovell/sharp/issues/2578)
-
-* Ensure composite does not clip top and left offsets.
- [#2594](https://github.com/lovell/sharp/pull/2594)
- [@SHG42](https://github.com/SHG42)
-
-* Improve error handling of network failure at install time.
- [#2608](https://github.com/lovell/sharp/pull/2608)
- [@abradley](https://github.com/abradley)
-
-* Ensure `@id` attribute can be set for IIIF tile-based output.
- [#2612](https://github.com/lovell/sharp/issues/2612)
- [@edsilv](https://github.com/edsilv)
-
-* Ensure composite replicates the correct number of tiles for centred gravities.
- [#2626](https://github.com/lovell/sharp/issues/2626)
-
-## v0.27 - *avif*
-
-Requires libvips v8.10.5
-
-### v0.27.2 - 22nd February 2021
-
-* macOS: Prevent use of globally-installed ARM64 libvips with Rosetta x64 emulation.
- [#2460](https://github.com/lovell/sharp/issues/2460)
-
-* Linux (musl): Prevent use of prebuilt linuxmusl-x64 binaries with musl >= 1.2.0.
- [#2570](https://github.com/lovell/sharp/issues/2570)
-
-* Improve 16-bit grey+alpha support by using libvips' `has_alpha` detection.
- [#2569](https://github.com/lovell/sharp/issues/2569)
-
-* Allow the use of non lower case extensions with `toFormat`.
- [#2581](https://github.com/lovell/sharp/pull/2581)
- [@florian-busch](https://github.com/florian-busch)
-
-* Allow use of `recomb` operation with single channel input.
- [#2584](https://github.com/lovell/sharp/issues/2584)
-
-### v0.27.1 - 27th January 2021
-
-* Ensure TIFF is cast when using float predictor.
- [#2502](https://github.com/lovell/sharp/pull/2502)
- [@randyridge](https://github.com/randyridge)
-
-* Add support for Uint8Array and Uint8ClampedArray input.
- [#2511](https://github.com/lovell/sharp/pull/2511)
- [@leon](https://github.com/leon)
-
-* Revert: ensure all platforms use fontconfig for font rendering.
- [#2515](https://github.com/lovell/sharp/issues/2515)
-
-* Expose libvips gaussnoise operation to allow creation of Gaussian noise.
- [#2527](https://github.com/lovell/sharp/pull/2527)
- [@alza54](https://github.com/alza54)
-
-### v0.27.0 - 22nd December 2020
-
-* Add support for AVIF to prebuilt binaries.
-
-* Remove experimental status from `heif` output, defaults are now AVIF-centric.
-
-* Allow negative top/left offsets for composite operation.
- [#2391](https://github.com/lovell/sharp/pull/2391)
- [@CurosMJ](https://github.com/CurosMJ)
-
-* Ensure all platforms use fontconfig for font rendering.
- [#2399](https://github.com/lovell/sharp/issues/2399)
-
-## v0.26 - *zoom*
-
-Requires libvips v8.10.0
-
-### v0.26.3 - 16th November 2020
-
-* Expose libvips' affine operation.
- [#2336](https://github.com/lovell/sharp/pull/2336)
- [@guillevc](https://github.com/guillevc)
-
-* Fallback to tar.gz for prebuilt libvips when Brotli not available.
- [#2412](https://github.com/lovell/sharp/pull/2412)
- [@ascorbic](https://github.com/ascorbic)
-
-### v0.26.2 - 14th October 2020
-
-* Add support for EXR input. Requires libvips compiled with OpenEXR.
- [#698](https://github.com/lovell/sharp/issues/698)
-
-* Ensure support for yarn v2.
- [#2379](https://github.com/lovell/sharp/pull/2379)
- [@jalovatt](https://github.com/jalovatt)
-
-* Add centre/center option to tile-based output.
- [#2397](https://github.com/lovell/sharp/pull/2397)
- [@beig](https://github.com/beig)
-
-### v0.26.1 - 20th September 2020
-
-* Ensure correct pageHeight when verifying multi-page image dimensions.
- [#2343](https://github.com/lovell/sharp/pull/2343)
- [@derom](https://github.com/derom)
-
-* Allow input density range up to 100000 DPI.
- [#2348](https://github.com/lovell/sharp/pull/2348)
- [@stefanprobst](https://github.com/stefanprobst)
-
-* Ensure animation-related properties can be set for Stream-based input.
- [#2369](https://github.com/lovell/sharp/pull/2369)
- [@AcrylicShrimp](https://github.com/AcrylicShrimp)
-
-* Ensure `stats` can be calculated for 1x1 input.
- [#2372](https://github.com/lovell/sharp/issues/2372)
-
-* Ensure animated GIF output is optimised.
- [#2376](https://github.com/lovell/sharp/issues/2376)
-
-### v0.26.0 - 25th August 2020
-
-* Prebuilt libvips binaries are now statically-linked and Brotli-compressed, requiring Node.js 10.16.0+.
-
-* TIFF output `squash` is replaced by `bitdepth` to reduce to 1, 2 or 4 bit.
-
-* JPEG output `quality` >= 90 no longer automatically sets `chromaSubsampling` to `4:4:4`.
-
-* Add most `dominant` colour to image `stats`.
- [#640](https://github.com/lovell/sharp/issues/640)
-
-* Add support for animated GIF (requires \*magick) and WebP output.
- [#2012](https://github.com/lovell/sharp/pull/2012)
- [@deftomat](https://github.com/deftomat)
-
-* Add support for libvips ImageMagick v7 loaders.
- [#2258](https://github.com/lovell/sharp/pull/2258)
- [@vouillon](https://github.com/vouillon)
-
-* Allow multi-page input via \*magick.
- [#2259](https://github.com/lovell/sharp/pull/2259)
- [@vouillon](https://github.com/vouillon)
-
-* Add support to `withMetadata` for custom ICC profile.
- [#2271](https://github.com/lovell/sharp/pull/2271)
- [@roborourke](https://github.com/roborourke)
-
-* Ensure prebuilt binaries for ARM default to v7 when using Electron.
- [#2292](https://github.com/lovell/sharp/pull/2292)
- [@diegodev3](https://github.com/diegodev3)
-
-## v0.25 - *yield*
-
-Requires libvips v8.9.1
-
-### v0.25.4 - 12th June 2020
-
-* Allow libvips binary location override where version is appended.
- [#2217](https://github.com/lovell/sharp/pull/2217)
- [@malice00](https://github.com/malice00)
-
-* Enable PNG palette when setting quality, colours, colors or dither.
- [#2226](https://github.com/lovell/sharp/pull/2226)
- [@romaleev](https://github.com/romaleev)
-
-* Add `level` constructor option to use a specific level of a multi-level image.
- Expose `levels` metadata for multi-level images.
- [#2222](https://github.com/lovell/sharp/issues/2222)
-
-* Add support for named `alpha` channel to `extractChannel` operation.
- [#2138](https://github.com/lovell/sharp/issues/2138)
-
-* Add experimental `sharpness` calculation to `stats()` response.
- [#2251](https://github.com/lovell/sharp/issues/2251)
-
-* Emit `warning` event for non-critical processing problems.
- [#2032](https://github.com/lovell/sharp/issues/2032)
-
-### v0.25.3 - 17th May 2020
-
-* Ensure libvips is initialised only once, improves worker thread safety.
- [#2143](https://github.com/lovell/sharp/issues/2143)
-
-* Ensure npm platform flag is respected when copying DLLs.
- [#2188](https://github.com/lovell/sharp/pull/2188)
- [@dimadeveatii](https://github.com/dimadeveatii)
-
-* Allow SVG input with large inline images to be parsed.
- [#2195](https://github.com/lovell/sharp/issues/2195)
-
-### v0.25.2 - 20th March 2020
-
-* Provide prebuilt binaries for Linux ARM64v8.
-
-* Add IIIF layout support to tile-based output.
- [#2098](https://github.com/lovell/sharp/pull/2098)
- [@edsilv](https://github.com/edsilv)
-
-* Ensure input options are consistently and correctly detected.
- [#2118](https://github.com/lovell/sharp/issues/2118)
-
-* Ensure N-API prebuilt binaries work on RHEL7 and its derivatives.
- [#2119](https://github.com/lovell/sharp/issues/2119)
-
-* Ensure AsyncWorker options are persisted.
- [#2130](https://github.com/lovell/sharp/issues/2130)
-
-### v0.25.1 - 7th March 2020
-
-* Ensure prebuilt binaries are fetched based on N-API version.
- [#2117](https://github.com/lovell/sharp/issues/2117)
-
-### v0.25.0 - 7th March 2020
-
-* Remove `limitInputPixels` and `sequentialRead` previously deprecated in v0.24.0.
-
-* Migrate internals to N-API.
- [#1282](https://github.com/lovell/sharp/issues/1282)
-
-* Add support for 32-bit Windows.
- [#2088](https://github.com/lovell/sharp/issues/2088)
-
-* Ensure correct ordering of rotate-then-trim operations.
- [#2087](https://github.com/lovell/sharp/issues/2087)
-
-* Ensure composite accepts `limitInputPixels` and `sequentialRead` input options.
- [#2099](https://github.com/lovell/sharp/issues/2099)
-
-## v0.24 - "*wit*"
-
-Requires libvips v8.9.0.
-
-### v0.24.1 - 15th February 2020
-
-* Prevent use of sequentialRead for EXIF-based rotate operation.
- [#2042](https://github.com/lovell/sharp/issues/2042)
-
-* Ensure RGBA LZW TIFF returns correct channel count.
- [#2064](https://github.com/lovell/sharp/issues/2064)
-
-### v0.24.0 - 16th January 2020
-
-* Drop support for Node.js 8.
- [#1910](https://github.com/lovell/sharp/issues/1910)
-
-* Drop support for undefined input where options also provided.
- [#1768](https://github.com/lovell/sharp/issues/1768)
-
-* Move `limitInputPixels` and `sequentialRead` to input options, deprecating functions of the same name.
-
-* Expose `delay` and `loop` metadata for animated images.
- [#1905](https://github.com/lovell/sharp/issues/1905)
-
-* Ensure correct colour output for 16-bit, 2-channel PNG input with ICC profile.
- [#2013](https://github.com/lovell/sharp/issues/2013)
-
-* Prevent use of sequentialRead for rotate operations.
- [#2016](https://github.com/lovell/sharp/issues/2016)
-
-* Correctly bind max width and height values when using withoutEnlargement.
- [#2024](https://github.com/lovell/sharp/pull/2024)
- [@BrychanOdlum](https://github.com/BrychanOdlum)
-
-* Add support for input with 16-bit RGB profile.
- [#2037](https://github.com/lovell/sharp/issues/2037)
-
-## v0.23 - "*vision*"
-
-Requires libvips v8.8.1.
-
-### v0.23.4 - 5th December 2019
-
-* Handle zero-length Buffer objects when using Node.js v13.2.0+.
-
-* Expose raw TIFFTAG_PHOTOSHOP metadata.
- [#1600](https://github.com/lovell/sharp/issues/1600)
-
-* Improve thread safety by using copy-on-write when updating metadata.
- [#1986](https://github.com/lovell/sharp/issues/1986)
-
-### v0.23.3 - 17th November 2019
-
-* Ensure `trim` operation supports images contained in the alpha channel.
- [#1597](https://github.com/lovell/sharp/issues/1597)
-
-* Ensure tile `overlap` option works as expected.
- [#1921](https://github.com/lovell/sharp/pull/1921)
- [@rustyguts](https://github.com/rustyguts)
-
-* Allow compilation on FreeBSD and variants (broken since v0.23.0)
- [#1952](https://github.com/lovell/sharp/pull/1952)
- [@pouya-eghbali](https://github.com/pouya-eghbali)
-
-* Ensure `modulate` and other colour-based operations can co-exist.
- [#1958](https://github.com/lovell/sharp/issues/1958)
-
-### v0.23.2 - 28th October 2019
-
-* Add `background` option to tile output operation.
- [#1924](https://github.com/lovell/sharp/pull/1924)
- [@neave](https://github.com/neave)
-
-* Add support for Node.js 13.
- [#1932](https://github.com/lovell/sharp/pull/1932)
- [@MayhemYDG](https://github.com/MayhemYDG)
-
-### v0.23.1 - 26th September 2019
-
-* Ensure `sharp.format.vips` is present and correct (filesystem only).
- [#1813](https://github.com/lovell/sharp/issues/1813)
-
-* Ensure invalid `width` and `height` provided as options to `resize` throw.
- [#1817](https://github.com/lovell/sharp/issues/1817)
-
-* Allow use of 'heic' and 'heif' identifiers with `toFormat`.
- [#1834](https://github.com/lovell/sharp/pull/1834)
- [@jaubourg](https://github.com/jaubourg)
-
-* Add `premultiplied` option to `composite` operation.
- [#1835](https://github.com/lovell/sharp/pull/1835)
- [@Andargor](https://github.com/Andargor)
-
-* Allow instance reuse with differing `toBuffer` options.
- [#1860](https://github.com/lovell/sharp/pull/1860)
- [@RaboliotTheGrey](https://github.com/RaboliotTheGrey)
-
-* Ensure image is at least 3x3 pixels before attempting trim operation.
-
-### v0.23.0 - 29th July 2019
-
-* Remove `overlayWith` previously deprecated in v0.22.0.
-
-* Add experimental support for HEIF images. Requires libvips compiled with libheif.
- [#1105](https://github.com/lovell/sharp/issues/1105)
-
-* Expose libwebp `smartSubsample` and `reductionEffort` options.
- [#1545](https://github.com/lovell/sharp/issues/1545)
-
-* Add experimental support for Worker Threads.
- [#1558](https://github.com/lovell/sharp/issues/1558)
-
-* Use libvips' built-in CMYK and sRGB profiles when required.
- [#1619](https://github.com/lovell/sharp/issues/1619)
-
-* Drop support for Node.js versions 6 and 11.
- [#1674](https://github.com/lovell/sharp/issues/1674)
-
-* Expose `skipBlanks` option for tile-based output.
- [#1687](https://github.com/lovell/sharp/pull/1687)
- [@RaboliotTheGrey](https://github.com/RaboliotTheGrey)
-
-* Allow use of `failOnError` option with Stream-based input.
- [#1691](https://github.com/lovell/sharp/issues/1691)
-
-* Fix rotate/extract ordering for non-90 angles.
- [#1755](https://github.com/lovell/sharp/pull/1755)
- [@iovdin](https://github.com/iovdin)
-
-## v0.22 - "*uptake*"
-
-Requires libvips v8.7.4.
-
-### v0.22.1 - 25th April 2019
-
-* Add `modulate` operation for brightness, saturation and hue.
- [#1601](https://github.com/lovell/sharp/pull/1601)
- [@Goues](https://github.com/Goues)
-
-* Improve help messaging should `require("sharp")` fail.
- [#1638](https://github.com/lovell/sharp/pull/1638)
- [@sidharthachatterjee](https://github.com/sidharthachatterjee)
-
-* Add support for Node 12.
- [#1668](https://github.com/lovell/sharp/issues/1668)
-
-### v0.22.0 - 18th March 2019
-
-* Remove functions previously deprecated in v0.21.0:
- `background`, `crop`, `embed`, `ignoreAspectRatio`, `max`, `min` and `withoutEnlargement`.
-
-* Add `composite` operation supporting multiple images and blend modes; deprecate `overlayWith`.
- [#728](https://github.com/lovell/sharp/issues/728)
-
-* Add support for `pages` input option for multi-page input.
- [#1566](https://github.com/lovell/sharp/issues/1566)
-
-* Allow Stream-based input of raw pixel data.
- [#1579](https://github.com/lovell/sharp/issues/1579)
-
-* Add support for `page` input option to GIF and PDF.
- [#1595](https://github.com/lovell/sharp/pull/1595)
- [@ramiel](https://github.com/ramiel)
-
-## v0.21 - "*teeth*"
-
-Requires libvips v8.7.0.
-
-### v0.21.3 - 19th January 2019
-
-* Input image decoding now fails fast, set `failOnError` to change this behaviour.
-
-* Failed filesystem-based input now separates missing file and invalid format errors.
- [#1542](https://github.com/lovell/sharp/issues/1542)
-
-### v0.21.2 - 13th January 2019
-
-* Ensure all metadata is removed from PNG output unless `withMetadata` used.
-
-* Ensure shortest edge is at least one pixel after resizing.
- [#1003](https://github.com/lovell/sharp/issues/1003)
-
-* Add `ensureAlpha` operation to add an alpha channel, if missing.
- [#1153](https://github.com/lovell/sharp/issues/1153)
-
-* Expose `pages` and `pageHeight` metadata for multi-page input images.
- [#1205](https://github.com/lovell/sharp/issues/1205)
-
-* Expose PNG output options requiring libimagequant.
- [#1484](https://github.com/lovell/sharp/issues/1484)
-
-* Expose underlying error message for invalid input.
- [#1505](https://github.com/lovell/sharp/issues/1505)
-
-* Prevent mutatation of options passed to `jpeg`.
- [#1516](https://github.com/lovell/sharp/issues/1516)
-
-* Ensure forced output format applied correctly when output chaining.
- [#1528](https://github.com/lovell/sharp/issues/1528)
-
-### v0.21.1 - 7th December 2018
-
-* Install: support `sharp_dist_base_url` npm config, like existing `SHARP_DIST_BASE_URL`.
- [#1422](https://github.com/lovell/sharp/pull/1422)
- [@SethWen](https://github.com/SethWen)
-
-* Ensure `channel` metadata is correct for raw, greyscale output.
- [#1425](https://github.com/lovell/sharp/issues/1425)
-
-* Add support for the "mitchell" kernel for image reductions.
- [#1438](https://github.com/lovell/sharp/pull/1438)
- [@Daiz](https://github.com/Daiz)
-
-* Allow separate parameters for gamma encoding and decoding.
- [#1439](https://github.com/lovell/sharp/pull/1439)
- [@Daiz](https://github.com/Daiz)
-
-* Build prototype with `Object.assign` to allow minification.
- [#1475](https://github.com/lovell/sharp/pull/1475)
- [@jaubourg](https://github.com/jaubourg)
-
-* Expose libvips' recombination matrix operation.
- [#1477](https://github.com/lovell/sharp/pull/1477)
- [@fromkeith](https://github.com/fromkeith)
-
-* Expose libvips' pyramid/tile options for TIFF output.
- [#1483](https://github.com/lovell/sharp/pull/1483)
- [@mbklein](https://github.com/mbklein)
-
-### v0.21.0 - 4th October 2018
-
-* Deprecate the following resize-related functions:
- `crop`, `embed`, `ignoreAspectRatio`, `max`, `min` and `withoutEnlargement`.
- Access to these is now via options passed to the `resize` function.
- For example:
- `embed('north')` is now `resize(width, height, { fit: 'contain', position: 'north' })`,
- `crop('attention')` is now `resize(width, height, { fit: 'cover', position: 'attention' })`,
- `max().withoutEnlargement()` is now `resize(width, height, { fit: 'inside', withoutEnlargement: true })`.
- [#1135](https://github.com/lovell/sharp/issues/1135)
-
-* Deprecate the `background` function.
- Per-operation `background` options added to `resize`, `extend` and `flatten` operations.
- [#1392](https://github.com/lovell/sharp/issues/1392)
-
-* Add `size` to `metadata` response (Stream and Buffer input only).
- [#695](https://github.com/lovell/sharp/issues/695)
-
-* Switch from custom trim operation to `vips_find_trim`.
- [#914](https://github.com/lovell/sharp/issues/914)
-
-* Add `chromaSubsampling` and `isProgressive` properties to `metadata` response.
- [#1186](https://github.com/lovell/sharp/issues/1186)
-
-* Drop Node 4 support.
- [#1212](https://github.com/lovell/sharp/issues/1212)
-
-* Enable SIMD convolution by default.
- [#1213](https://github.com/lovell/sharp/issues/1213)
-
-* Add experimental prebuilt binaries for musl-based Linux.
- [#1379](https://github.com/lovell/sharp/issues/1379)
-
-* Add support for arbitrary rotation angle via vips_rotate.
- [#1385](https://github.com/lovell/sharp/pull/1385)
- [@freezy](https://github.com/freezy)
-
-## v0.20 - "*prebuild*"
-
-Requires libvips v8.6.1.
-
-### v0.20.8 - 5th September 2018
-
-* Avoid race conditions when creating directories during installation.
- [#1358](https://github.com/lovell/sharp/pull/1358)
- [@ajhool](https://github.com/ajhool)
-
-* Accept floating point values for input density parameter.
- [#1362](https://github.com/lovell/sharp/pull/1362)
- [@aeirola](https://github.com/aeirola)
-
-### v0.20.7 - 21st August 2018
-
-* Use copy+unlink if rename operation fails during installation.
- [#1345](https://github.com/lovell/sharp/issues/1345)
-
-### v0.20.6 - 20th August 2018
-
-* Add removeAlpha operation to remove alpha channel, if any.
- [#1248](https://github.com/lovell/sharp/issues/1248)
-
-* Expose mozjpeg quant_table flag.
- [#1285](https://github.com/lovell/sharp/pull/1285)
- [@rexxars](https://github.com/rexxars)
-
-* Allow full WebP alphaQuality range of 0-100.
- [#1290](https://github.com/lovell/sharp/pull/1290)
- [@sylvaindumont](https://github.com/sylvaindumont)
-
-* Cache libvips binaries to reduce re-install time.
- [#1301](https://github.com/lovell/sharp/issues/1301)
-
-* Ensure vendor platform mismatch throws error at install time.
- [#1303](https://github.com/lovell/sharp/issues/1303)
-
-* Improve install time error messages for FreeBSD users.
- [#1310](https://github.com/lovell/sharp/issues/1310)
-
-* Ensure extractChannel works with 16-bit images.
- [#1330](https://github.com/lovell/sharp/issues/1330)
-
-* Expose depth option for tile-based output.
- [#1342](https://github.com/lovell/sharp/pull/1342)
- [@alundavies](https://github.com/alundavies)
-
-* Add experimental entropy field to stats response.
-
-### v0.20.5 - 27th June 2018
-
-* Expose libjpeg optimize_coding flag.
- [#1265](https://github.com/lovell/sharp/pull/1265)
- [@tomlokhorst](https://github.com/tomlokhorst)
-
-### v0.20.4 - 20th June 2018
-
-* Prevent possible rounding error when using shrink-on-load and 90/270 degree rotation.
- [#1241](https://github.com/lovell/sharp/issues/1241)
- [@anahit42](https://github.com/anahit42)
-
-* Ensure extractChannel sets correct single-channel colour space interpretation.
- [#1257](https://github.com/lovell/sharp/issues/1257)
- [@jeremychone](https://github.com/jeremychone)
-
-### v0.20.3 - 29th May 2018
-
-* Fix tint operation by ensuring LAB interpretation and allowing negative values.
- [#1235](https://github.com/lovell/sharp/issues/1235)
- [@wezside](https://github.com/wezside)
-
-### v0.20.2 - 28th April 2018
-
-* Add tint operation to set image chroma.
- [#825](https://github.com/lovell/sharp/pull/825)
- [@rikh42](https://github.com/rikh42)
-
-* Add environment variable to ignore globally-installed libvips.
- [#1165](https://github.com/lovell/sharp/pull/1165)
- [@oncletom](https://github.com/oncletom)
-
-* Add support for page selection with multi-page input (GIF/TIFF).
- [#1204](https://github.com/lovell/sharp/pull/1204)
- [@woolite64](https://github.com/woolite64)
-
-* Add support for Group4 (CCITTFAX4) compression with TIFF output.
- [#1208](https://github.com/lovell/sharp/pull/1208)
- [@woolite64](https://github.com/woolite64)
-
-### v0.20.1 - 17th March 2018
-
-* Improve installation experience when a globally-installed libvips below the minimum required version is found.
- [#1148](https://github.com/lovell/sharp/issues/1148)
-
-* Prevent smartcrop error when cumulative rounding is below target size.
- [#1154](https://github.com/lovell/sharp/issues/1154)
- [@ralrom](https://github.com/ralrom)
-
-* Expose libvips' median filter operation.
- [#1161](https://github.com/lovell/sharp/pull/1161)
- [@BiancoA](https://github.com/BiancoA)
-
-### v0.20.0 - 5th March 2018
-
-* Add support for prebuilt sharp binaries on common platforms.
- [#186](https://github.com/lovell/sharp/issues/186)
-
-## v0.19 - "*suit*"
-
-Requires libvips v8.6.1.
-
-### v0.19.1 - 24th February 2018
-
-* Expose libvips' linear transform feature.
- [#1024](https://github.com/lovell/sharp/pull/1024)
- [@3epnm](https://github.com/3epnm)
-
-* Expose angle option for tile-based output.
- [#1121](https://github.com/lovell/sharp/pull/1121)
- [@BiancoA](https://github.com/BiancoA)
-
-* Prevent crop operation when image already at or below target dimensions.
- [#1134](https://github.com/lovell/sharp/issues/1134)
- [@pieh](https://github.com/pieh)
-
-### v0.19.0 - 11th January 2018
-
-* Expose offset coordinates of strategy-based crop.
- [#868](https://github.com/lovell/sharp/issues/868)
- [@mirohristov-com](https://github.com/mirohristov-com)
-
-* PNG output now defaults to adaptiveFiltering=false, compressionLevel=9
- [#872](https://github.com/lovell/sharp/issues/872)
- [@wmertens](https://github.com/wmertens)
-
-* Add stats feature for pixel-derived image statistics.
- [#915](https://github.com/lovell/sharp/pull/915)
- [@rnanwani](https://github.com/rnanwani)
-
-* Add failOnError option to fail-fast on bad input image data.
- [#976](https://github.com/lovell/sharp/pull/976)
- [@mceachen](https://github.com/mceachen)
-
-* Resize: switch to libvips' implementation, make fastShrinkOnLoad optional, remove interpolator and centreSampling options.
- [#977](https://github.com/lovell/sharp/pull/977)
- [@jardakotesovec](https://github.com/jardakotesovec)
-
-* Attach finish event listener to a clone only for Stream-based input.
- [#995](https://github.com/lovell/sharp/issues/995)
- [@whmountains](https://github.com/whmountains)
-
-* Add tilecache before smartcrop to avoid over-computation of previous operations.
- [#1028](https://github.com/lovell/sharp/issues/1028)
- [@coffeebite](https://github.com/coffeebite)
-
-* Prevent toFile extension taking precedence over requested format.
- [#1037](https://github.com/lovell/sharp/issues/1037)
- [@tomgallagher](https://github.com/tomgallagher)
-
-* Add support for gravity option to existing embed feature.
- [#1038](https://github.com/lovell/sharp/pull/1038)
- [@AzureByte](https://github.com/AzureByte)
-
-* Expose IPTC and XMP metadata when available.
- [#1079](https://github.com/lovell/sharp/pull/1079)
- [@oaleynik](https://github.com/oaleynik)
-
-* TIFF output: switch default predictor from 'none' to 'horizontal' to match libvips' behaviour.
-
-## v0.18 - "*ridge*"
-
-Requires libvips v8.5.5.
-
-### v0.18.4 - 18th September 2017
-
-* Ensure input Buffer really is marked as Persistent, prevents mark-sweep GC.
- [#950](https://github.com/lovell/sharp/issues/950)
- [@lfdoherty](https://github.com/lfdoherty)
-
-### v0.18.3 - 13th September 2017
-
-* Skip shrink-on-load when trimming.
- [#888](https://github.com/lovell/sharp/pull/888)
- [@kleisauke](https://github.com/kleisauke)
-
-* Migrate from got to simple-get for basic auth support.
- [#945](https://github.com/lovell/sharp/pull/945)
- [@pbomb](https://github.com/pbomb)
-
-### v0.18.2 - 1st July 2017
-
-* Expose libvips' xres and yres properties for TIFF output.
- [#828](https://github.com/lovell/sharp/pull/828)
- [@YvesBos](https://github.com/YvesBos)
-
-* Ensure flip and flop operations work with auto-rotate.
- [#837](https://github.com/lovell/sharp/issues/837)
- [@rexxars](https://github.com/rexxars)
-
-* Allow binary download URL override via SHARP_DIST_BASE_URL env variable.
- [#841](https://github.com/lovell/sharp/issues/841)
-
-* Add support for Solus Linux.
- [#857](https://github.com/lovell/sharp/pull/857)
- [@ekremkaraca](https://github.com/ekremkaraca)
-
-### v0.18.1 - 30th May 2017
-
-* Remove regression from #781 that could cause incorrect shrink calculation.
- [#831](https://github.com/lovell/sharp/issues/831)
- [@suprMax](https://github.com/suprMax)
-
-### v0.18.0 - 30th May 2017
-
-* Remove the previously-deprecated output format "option" functions:
- quality, progressive, compressionLevel, withoutAdaptiveFiltering,
- withoutChromaSubsampling, trellisQuantisation, trellisQuantization,
- overshootDeringing, optimiseScans and optimizeScans.
-
-* Ensure maximum output dimensions are based on the format to be used.
- [#176](https://github.com/lovell/sharp/issues/176)
- [@stephanebachelier](https://github.com/stephanebachelier)
-
-* Avoid costly (un)premultiply when using overlayWith without alpha channel.
- [#573](https://github.com/lovell/sharp/issues/573)
- [@strarsis](https://github.com/strarsis)
-
-* Include pixel depth (e.g. "uchar") when reading metadata.
- [#577](https://github.com/lovell/sharp/issues/577)
- [@moedusa](https://github.com/moedusa)
-
-* Add support for Buffer and Stream-based TIFF output.
- [#587](https://github.com/lovell/sharp/issues/587)
- [@strarsis](https://github.com/strarsis)
-
-* Expose warnings from libvips via NODE_DEBUG=sharp environment variable.
- [#607](https://github.com/lovell/sharp/issues/607)
- [@puzrin](https://github.com/puzrin)
-
-* Switch to the libvips implementation of "attention" and "entropy" crop strategies.
- [#727](https://github.com/lovell/sharp/issues/727)
-
-* Improve performance and accuracy of nearest neighbour integral upsampling.
- [#752](https://github.com/lovell/sharp/issues/752)
- [@MrIbby](https://github.com/MrIbby)
-
-* Constructor single argument API: allow plain object, reject null/undefined.
- [#768](https://github.com/lovell/sharp/issues/768)
- [@kub1x](https://github.com/kub1x)
-
-* Ensure ARM64 pre-built binaries use correct C++11 ABI version.
- [#772](https://github.com/lovell/sharp/issues/772)
- [@ajiratech2](https://github.com/ajiratech2)
-
-* Prevent aliasing by using dynamic values for shrink(-on-load).
- [#781](https://github.com/lovell/sharp/issues/781)
- [@kleisauke](https://github.com/kleisauke)
-
-* Expose libvips' "squash" parameter to enable 1-bit TIFF output.
- [#783](https://github.com/lovell/sharp/pull/783)
- [@YvesBos](https://github.com/YvesBos)
-
-* Add support for rotation using any multiple of +/-90 degrees.
- [#791](https://github.com/lovell/sharp/pull/791)
- [@ncoden](https://github.com/ncoden)
-
-* Add "jpg" alias to toFormat as shortened form of "jpeg".
- [#814](https://github.com/lovell/sharp/pull/814)
- [@jingsam](https://github.com/jingsam)
-
-## v0.17 - "*quill*"
-
-Requires libvips v8.4.2.
-
-### v0.17.3 - 1st April 2017
-
-* Allow toBuffer to optionally resolve a Promise with both info and data.
- [#143](https://github.com/lovell/sharp/issues/143)
- [@salzhrani](https://github.com/salzhrani)
-
-* Create blank image of given width, height, channels and background.
- [#470](https://github.com/lovell/sharp/issues/470)
- [@pjarts](https://github.com/pjarts)
-
-* Add support for the "nearest" kernel for image reductions.
- [#732](https://github.com/lovell/sharp/pull/732)
- [@alice0meta](https://github.com/alice0meta)
-
-* Add support for TIFF compression and predictor options.
- [#738](https://github.com/lovell/sharp/pull/738)
- [@kristojorg](https://github.com/kristojorg)
-
-### v0.17.2 - 11th February 2017
-
-* Ensure Readable side of Stream can start flowing after Writable side has finished.
- [#671](https://github.com/lovell/sharp/issues/671)
- [@danhaller](https://github.com/danhaller)
-
-* Expose WebP alpha quality, lossless and near-lossless output options.
- [#685](https://github.com/lovell/sharp/pull/685)
- [@rnanwani](https://github.com/rnanwani)
-
-### v0.17.1 - 15th January 2017
-
-* Improve error messages for invalid parameters.
- [@spikeon](https://github.com/spikeon)
- [#644](https://github.com/lovell/sharp/pull/644)
-
-* Simplify expression for finding vips-cpp libdir.
- [#656](https://github.com/lovell/sharp/pull/656)
-
-* Allow HTTPS-over-HTTP proxy when downloading pre-compiled dependencies.
- [@wangzhiwei1888](https://github.com/wangzhiwei1888)
- [#679](https://github.com/lovell/sharp/issues/679)
-
-### v0.17.0 - 11th December 2016
-
-* Drop support for versions of Node prior to v4.
-
-* Deprecate the following output format "option" functions:
- quality, progressive, compressionLevel, withoutAdaptiveFiltering,
- withoutChromaSubsampling, trellisQuantisation, trellisQuantization,
- overshootDeringing, optimiseScans and optimizeScans.
- Access to these is now via output format functions, for example `quality(n)`
- is now `jpeg({quality: n})` and/or `webp({quality: n})`.
-
-* Autoconvert GIF and SVG input to PNG output if no other format is specified.
-
-* Expose libvips' "centre" resize option to mimic \*magick's +0.5px convention.
- [#568](https://github.com/lovell/sharp/issues/568)
-
-* Ensure support for embedded base64 PNG and JPEG images within an SVG.
- [#601](https://github.com/lovell/sharp/issues/601)
- [@dynamite-ready](https://github.com/dynamite-ready)
-
-* Ensure premultiply operation occurs before box filter shrink.
- [#605](https://github.com/lovell/sharp/issues/605)
- [@CmdrShepardsPie](https://github.com/CmdrShepardsPie)
- [@teroparvinen](https://github.com/teroparvinen)
-
-* Add support for PNG and WebP tile-based output formats (in addition to JPEG).
- [#622](https://github.com/lovell/sharp/pull/622)
- [@ppaskaris](https://github.com/ppaskaris)
-
-* Allow use of extend with greyscale input.
- [#623](https://github.com/lovell/sharp/pull/623)
- [@ppaskaris](https://github.com/ppaskaris)
-
-* Allow non-RGB input to embed/extend onto background with an alpha channel.
- [#646](https://github.com/lovell/sharp/issues/646)
- [@DaGaMs](https://github.com/DaGaMs)
-
-## v0.16 - "*pencil*"
-
-Requires libvips v8.3.3
-
-### v0.16.2 - 22nd October 2016
-
-* Restrict readelf usage to Linux only when detecting global libvips version.
- [#602](https://github.com/lovell/sharp/issues/602)
- [@caoko](https://github.com/caoko)
-
-### v0.16.1 - 13th October 2016
-
-* C++11 ABI version is now auto-detected, remove sharp-cxx11 installation flag.
-
-* Add experimental 'attention' crop strategy.
- [#295](https://github.com/lovell/sharp/issues/295)
-
-* Include .node extension for Meteor's require() implementation.
- [#537](https://github.com/lovell/sharp/issues/537)
- [@isjackwild](https://github.com/isjackwild)
-
-* Ensure convolution kernel scale is clamped to a minimum value of 1.
- [#561](https://github.com/lovell/sharp/issues/561)
- [@abagshaw](https://github.com/abagshaw)
-
-* Correct calculation of y-axis placement when overlaying image at a fixed point.
- [#566](https://github.com/lovell/sharp/issues/566)
- [@Nateowami](https://github.com/Nateowami)
-
-### v0.16.0 - 18th August 2016
-
-* Add pre-compiled libvips for OS X, ARMv7 and ARMv8.
- [#312](https://github.com/lovell/sharp/issues/312)
-
-* Ensure boolean, bandbool, extractChannel ops occur before sRGB conversion.
- [#504](https://github.com/lovell/sharp/pull/504)
- [@mhirsch](https://github.com/mhirsch)
-
-* Recalculate factors after WebP shrink-on-load to avoid round-to-zero errors.
- [#508](https://github.com/lovell/sharp/issues/508)
- [@asilvas](https://github.com/asilvas)
-
-* Prevent boolean errors during extract operation.
- [#511](https://github.com/lovell/sharp/pull/511)
- [@mhirsch](https://github.com/mhirsch)
-
-* Add joinChannel and toColourspace/toColorspace operations.
- [#513](https://github.com/lovell/sharp/pull/513)
- [@mhirsch](https://github.com/mhirsch)
-
-* Add support for raw pixel data with boolean and withOverlay operations.
- [#516](https://github.com/lovell/sharp/pull/516)
- [@mhirsch](https://github.com/mhirsch)
-
-* Prevent bandbool creating a single channel sRGB image.
- [#519](https://github.com/lovell/sharp/pull/519)
- [@mhirsch](https://github.com/mhirsch)
-
-* Ensure ICC profiles are removed from PNG output unless withMetadata used.
- [#521](https://github.com/lovell/sharp/issues/521)
- [@ChrisPinewood](https://github.com/ChrisPinewood)
-
-* Add alpha channels, if missing, to overlayWith images.
- [#540](https://github.com/lovell/sharp/pull/540)
- [@cmtt](https://github.com/cmtt)
-
-* Remove deprecated interpolateWith method - use resize(w, h, { interpolator: ... })
- [#310](https://github.com/lovell/sharp/issues/310)
-
-## v0.15 - "*outfit*"
-
-Requires libvips v8.3.1
-
-### v0.15.1 - 12th July 2016
-
-* Concat Stream-based input in single operation for ~+3% perf and less GC.
- [#429](https://github.com/lovell/sharp/issues/429)
- [@papandreou](https://github.com/papandreou)
-
-* Add alpha channel, if required, before extend operation.
- [#439](https://github.com/lovell/sharp/pull/439)
- [@frulo](https://github.com/frulo)
-
-* Allow overlay image to be repeated across entire image via tile option.
- [#443](https://github.com/lovell/sharp/pull/443)
- [@lemnisk8](https://github.com/lemnisk8)
-
-* Add cutout option to overlayWith feature, applies only the alpha channel of the overlay image.
- [#448](https://github.com/lovell/sharp/pull/448)
- [@kleisauke](https://github.com/kleisauke)
-
-* Ensure scaling factors are calculated independently to prevent rounding errors.
- [#452](https://github.com/lovell/sharp/issues/452)
- [@puzrin](https://github.com/puzrin)
-
-* Add --sharp-cxx11 flag to compile with gcc's new C++11 ABI.
- [#456](https://github.com/lovell/sharp/pull/456)
- [@kapouer](https://github.com/kapouer)
-
-* Add top/left offset support to overlayWith operation.
- [#473](https://github.com/lovell/sharp/pull/473)
- [@rnanwani](https://github.com/rnanwani)
-
-* Add convolve operation for kernel-based convolution.
- [#479](https://github.com/lovell/sharp/pull/479)
- [@mhirsch](https://github.com/mhirsch)
-
-* Add greyscale option to threshold operation for colourspace conversion control.
- [#480](https://github.com/lovell/sharp/pull/480)
- [@mhirsch](https://github.com/mhirsch)
-
-* Ensure ICC profiles are licenced for distribution.
- [#486](https://github.com/lovell/sharp/issues/486)
- [@kapouer](https://github.com/kapouer)
-
-* Allow images with an alpha channel to work with LAB-colourspace based sharpen.
- [#490](https://github.com/lovell/sharp/issues/490)
- [@jwagner](https://github.com/jwagner)
-
-* Add trim operation to remove "boring" edges.
- [#492](https://github.com/lovell/sharp/pull/492)
- [@kleisauke](https://github.com/kleisauke)
-
-* Add bandbool feature for channel-wise boolean operations.
- [#496](https://github.com/lovell/sharp/pull/496)
- [@mhirsch](https://github.com/mhirsch)
-
-* Add extractChannel operation to extract a channel from an image.
- [#497](https://github.com/lovell/sharp/pull/497)
- [@mhirsch](https://github.com/mhirsch)
-
-* Add ability to read and write native libvips .v files.
- [#500](https://github.com/lovell/sharp/pull/500)
- [@mhirsch](https://github.com/mhirsch)
-
-* Add boolean feature for bitwise image operations.
- [#501](https://github.com/lovell/sharp/pull/501)
- [@mhirsch](https://github.com/mhirsch)
-
-### v0.15.0 - 21st May 2016
-
-* Use libvips' new Lanczos 3 kernel as default for image reduction.
- Deprecate interpolateWith method, now provided as a resize option.
- [#310](https://github.com/lovell/sharp/issues/310)
- [@jcupitt](https://github.com/jcupitt)
-
-* Take advantage of libvips v8.3 features.
- Add support for libvips' new GIF and SVG loaders.
- Pre-built binaries now include giflib and librsvg, exclude *magick.
- Use shrink-on-load for WebP input.
- Break existing sharpen API to accept sigma and improve precision.
- [#369](https://github.com/lovell/sharp/issues/369)
-
-* Remove unnecessary (un)premultiply operations when not resizing/compositing.
- [#413](https://github.com/lovell/sharp/issues/413)
- [@jardakotesovec](https://github.com/jardakotesovec)
-
-## v0.14 - "*needle*"
-
-Requires libvips v8.2.3
-
-### v0.14.1 - 16th April 2016
-
-* Allow removal of limitation on input pixel count via limitInputPixels. Use with care.
- [#250](https://github.com/lovell/sharp/issues/250)
- [#316](https://github.com/lovell/sharp/pull/316)
- [@anandthakker](https://github.com/anandthakker)
- [@kentongray](https://github.com/kentongray)
-
-* Use final output image for metadata passed to callback.
- [#399](https://github.com/lovell/sharp/pull/399)
- [@salzhrani](https://github.com/salzhrani)
-
-* Add support for writing tiled images to a zip container.
- [#402](https://github.com/lovell/sharp/pull/402)
- [@felixbuenemann](https://github.com/felixbuenemann)
-
-* Allow use of embed with 1 and 2 channel images.
- [#411](https://github.com/lovell/sharp/issues/411)
- [@janaz](https://github.com/janaz)
-
-* Improve Electron compatibility by allowing node-gyp rebuilds without npm.
- [#412](https://github.com/lovell/sharp/issues/412)
- [@nouh](https://github.com/nouh)
-
-### v0.14.0 - 2nd April 2016
-
-* Add ability to extend (pad) the edges of an image.
- [#128](https://github.com/lovell/sharp/issues/128)
- [@blowsie](https://github.com/blowsie)
-
-* Add support for Zoomify and Google tile layouts. Breaks existing tile API.
- [#223](https://github.com/lovell/sharp/issues/223)
- [@bdunnette](https://github.com/bdunnette)
-
-* Improvements to overlayWith: differing sizes/formats, gravity, buffer input.
- [#239](https://github.com/lovell/sharp/issues/239)
- [@chrisriley](https://github.com/chrisriley)
-
-* Add entropy-based crop strategy to remove least interesting edges.
- [#295](https://github.com/lovell/sharp/issues/295)
- [@rightaway](https://github.com/rightaway)
-
-* Expose density metadata; set density of images from vector input.
- [#338](https://github.com/lovell/sharp/issues/338)
- [@lookfirst](https://github.com/lookfirst)
-
-* Emit post-processing 'info' event for Stream output.
- [#367](https://github.com/lovell/sharp/issues/367)
- [@salzhrani](https://github.com/salzhrani)
-
-* Ensure output image EXIF Orientation values are within 1-8 range.
- [#385](https://github.com/lovell/sharp/pull/385)
- [@jtobinisaniceguy](https://github.com/jtobinisaniceguy)
-
-* Ensure ratios are not swapped when rotating 90/270 and ignoring aspect.
- [#387](https://github.com/lovell/sharp/issues/387)
- [@kleisauke](https://github.com/kleisauke)
-
-* Remove deprecated style of calling extract API. Breaks calls using positional arguments.
- [#276](https://github.com/lovell/sharp/issues/276)
-
-## v0.13 - "*mind*"
-
-Requires libvips v8.2.2
-
-### v0.13.1 - 27th February 2016
-
-* Fix embedding onto transparent backgrounds; regression introduced in v0.13.0.
- [#366](https://github.com/lovell/sharp/issues/366)
- [@diegocsandrim](https://github.com/diegocsandrim)
-
-### v0.13.0 - 15th February 2016
-
-* Improve vector image support by allowing control of density/DPI.
- Switch pre-built libs from Imagemagick to Graphicsmagick.
- [#110](https://github.com/lovell/sharp/issues/110)
- [@bradisbell](https://github.com/bradisbell)
-
-* Add support for raw, uncompressed pixel Buffer/Stream input.
- [#220](https://github.com/lovell/sharp/issues/220)
- [@mikemorris](https://github.com/mikemorris)
-
-* Switch from libvips' C to C++ bindings, requires upgrade to v8.2.2.
- [#299](https://github.com/lovell/sharp/issues/299)
-
-* Control number of open files in libvips' cache; breaks existing `cache` behaviour.
- [#315](https://github.com/lovell/sharp/issues/315)
- [@impomezia](https://github.com/impomezia)
-
-* Ensure 16-bit input images can be normalised and embedded onto transparent backgrounds.
- [#339](https://github.com/lovell/sharp/issues/339)
- [#340](https://github.com/lovell/sharp/issues/340)
- [@janaz](https://github.com/janaz)
-
-* Ensure selected format takes precedence over any unknown output filename extension.
- [#344](https://github.com/lovell/sharp/issues/344)
- [@ubaltaci](https://github.com/ubaltaci)
-
-* Add support for libvips' PBM, PGM, PPM and FITS image format loaders.
- [#347](https://github.com/lovell/sharp/issues/347)
- [@oaleynik](https://github.com/oaleynik)
-
-* Ensure default crop gravity is center/centre.
- [#351](https://github.com/lovell/sharp/pull/351)
- [@joelmukuthu](https://github.com/joelmukuthu)
-
-* Improve support for musl libc systems e.g. Alpine Linux.
- [#354](https://github.com/lovell/sharp/issues/354)
- [#359](https://github.com/lovell/sharp/pull/359)
- [@download13](https://github.com/download13)
- [@wjordan](https://github.com/wjordan)
-
-* Small optimisation when reducing by an integral factor to favour shrink over affine.
-
-* Add support for gamma correction of images with an alpha channel.
-
-## v0.12 - "*look*"
-
-Requires libvips v8.2.0
-
-### v0.12.2 - 16th January 2016
-
-* Upgrade libvips to v8.2.0 for improved vips_shrink.
-
-* Add pre-compiled libvips for ARMv6+ CPUs.
-
-* Ensure 16-bit input images work with embed option.
- [#325](https://github.com/lovell/sharp/issues/325)
- [@janaz](https://github.com/janaz)
-
-* Allow compilation with gmake to provide FreeBSD support.
- [#326](https://github.com/lovell/sharp/issues/326)
- [@c0decafe](https://github.com/c0decafe)
-
-* Attempt to remove temporary file after installation.
- [#331](https://github.com/lovell/sharp/issues/331)
- [@dtoubelis](https://github.com/dtoubelis)
-
-### v0.12.1 - 12th December 2015
-
-* Allow use of SIMD vector instructions (via liborc) to be toggled on/off.
- [#172](https://github.com/lovell/sharp/issues/172)
- [@bkw](https://github.com/bkw)
- [@puzrin](https://github.com/puzrin)
-
-* Ensure embedded ICC profiles output with perceptual intent.
- [#321](https://github.com/lovell/sharp/issues/321)
- [@vlapo](https://github.com/vlapo)
-
-* Use the NPM-configured HTTPS proxy, if any, for binary downloads.
-
-### v0.12.0 - 23rd November 2015
-
-* Bundle pre-compiled libvips and its dependencies for 64-bit Linux and Windows.
- [#42](https://github.com/lovell/sharp/issues/42)
-
-* Take advantage of libvips v8.1.0+ features.
- [#152](https://github.com/lovell/sharp/issues/152)
-
-* Add support for 64-bit Windows. Drop support for 32-bit Windows.
- [#224](https://github.com/lovell/sharp/issues/224)
- [@sabrehagen](https://github.com/sabrehagen)
-
-* Switch default interpolator to bicubic.
- [#289](https://github.com/lovell/sharp/issues/289)
- [@mahnunchik](https://github.com/mahnunchik)
-
-* Pre-extract rotatation should not swap width/height.
- [#296](https://github.com/lovell/sharp/issues/296)
- [@asilvas](https://github.com/asilvas)
-
-* Ensure 16-bit+alpha input images are (un)premultiplied correctly.
- [#301](https://github.com/lovell/sharp/issues/301)
- [@izaakschroeder](https://github.com/izaakschroeder)
-
-* Add `threshold` operation.
- [#303](https://github.com/lovell/sharp/pull/303)
- [@dacarley](https://github.com/dacarley)
-
-* Add `negate` operation.
- [#306](https://github.com/lovell/sharp/pull/306)
- [@dacarley](https://github.com/dacarley)
-
-* Support `options` Object with existing `extract` operation.
- [#309](https://github.com/lovell/sharp/pull/309)
- [@papandreou](https://github.com/papandreou)
-
-## v0.11 - "*knife*"
-
-### v0.11.4 - 5th November 2015
-
-* Add corners, e.g. `northeast`, to existing `gravity` option.
- [#291](https://github.com/lovell/sharp/pull/291)
- [@brandonaaron](https://github.com/brandonaaron)
-
-* Ensure correct auto-rotation for EXIF Orientation values 2 and 4.
- [#288](https://github.com/lovell/sharp/pull/288)
- [@brandonaaron](https://github.com/brandonaaron)
-
-* Make static linking possible via `--runtime_link` install option.
- [#287](https://github.com/lovell/sharp/pull/287)
- [@vlapo](https://github.com/vlapo)
-
-### v0.11.3 - 8th September 2015
-
-* Intrepret blurSigma, sharpenFlat, and sharpenJagged as double precision.
- [#263](https://github.com/lovell/sharp/pull/263)
- [@chrisriley](https://github.com/chrisriley)
-
-### v0.11.2 - 28th August 2015
-
-* Allow crop gravity to be provided as a String.
- [#255](https://github.com/lovell/sharp/pull/255)
- [@papandreou](https://github.com/papandreou)
-* Add support for io.js v3 and Node v4.
- [#246](https://github.com/lovell/sharp/issues/246)
-
-### v0.11.1 - 12th August 2015
-
-* Silence MSVC warning: "C4530: C++ exception handler used, but unwind semantics are not enabled".
- [#244](https://github.com/lovell/sharp/pull/244)
- [@TheThing](https://github.com/TheThing)
-
-* Suppress gamma correction for input image with alpha transparency.
- [#249](https://github.com/lovell/sharp/issues/249)
- [@compeak](https://github.com/compeak)
-
-### v0.11.0 - 15th July 2015
-
-* Allow alpha transparency compositing via new `overlayWith` method.
- [#97](https://github.com/lovell/sharp/issues/97)
- [@gasi](https://github.com/gasi)
-
-* Expose raw ICC profile data as a Buffer when using `metadata`.
- [#129](https://github.com/lovell/sharp/issues/129)
- [@homerjam](https://github.com/homerjam)
-
-* Allow image header updates via a parameter passed to existing `withMetadata` method.
- Provide initial support for EXIF `Orientation` tag,
- which if present is now removed when using `rotate`, `flip` or `flop`.
- [#189](https://github.com/lovell/sharp/issues/189)
- [@h2non](https://github.com/h2non)
-
-* Tighten constructor parameter checks.
- [#221](https://github.com/lovell/sharp/issues/221)
- [@mikemorris](https://github.com/mikemorris)
-
-* Allow one input Stream to be shared with two or more output Streams via new `clone` method.
- [#235](https://github.com/lovell/sharp/issues/235)
- [@jaubourg](https://github.com/jaubourg)
-
-* Use `round` instead of `floor` when auto-scaling dimensions to avoid floating-point rounding errors.
- [#238](https://github.com/lovell/sharp/issues/238)
- [@richardadjogah](https://github.com/richardadjogah)
-
-## v0.10 - "*judgment*"
-
-### v0.10.1 - 1st June 2015
-
-* Allow embed of image with alpha transparency onto non-transparent background.
- [#204](https://github.com/lovell/sharp/issues/204)
- [@mikemliu](https://github.com/mikemliu)
-
-* Include C standard library for `atoi` as Xcode 6.3 appears to no longer do this.
- [#228](https://github.com/lovell/sharp/issues/228)
- [@doggan](https://github.com/doggan)
-
-### v0.10.0 - 23rd April 2015
-
-* Add support for Windows (x86).
- [#19](https://github.com/lovell/sharp/issues/19)
- [@DullReferenceException](https://github.com/DullReferenceException)
- [@itsananderson](https://github.com/itsananderson)
-
-* Add support for Openslide input and DeepZoom output.
- [#146](https://github.com/lovell/sharp/issues/146)
- [@mvictoras](https://github.com/mvictoras)
-
-* Allow arbitrary aspect ratios when resizing images via new `ignoreAspectRatio` method.
- [#192](https://github.com/lovell/sharp/issues/192)
- [@skedastik](https://github.com/skedastik)
-
-* Enhance output image contrast by stretching its luminance to cover the full dynamic range via new `normalize` method.
- [#194](https://github.com/lovell/sharp/issues/194)
- [@bkw](https://github.com/bkw)
- [@codingforce](https://github.com/codingforce)
diff --git a/docs/firebase.json b/docs/firebase.json
index 5ba9f56ce..f00270acb 100644
--- a/docs/firebase.json
+++ b/docs/firebase.json
@@ -1,118 +1,16 @@
{
"hosting": {
"site": "pixelplumbing-sharp",
- "public": ".",
- "ignore": [
- ".*",
- "build.js",
- "firebase.json",
- "*.md",
- "image/**",
- "search-index/**"
- ],
+ "public": "dist",
"headers": [
{
"source": "**",
"headers": [
- {
- "key": "Cache-Control",
- "value": "max-age=86400"
- }
+ { "key": "Cache-Control", "value": "max-age=86400" },
+ { "key": "X-Content-Type-Options", "value": "nosniff" },
+ { "key": "X-Frame-Options", "value": "SAMEORIGIN" }
]
}
- ],
- "redirects": [
- {
- "source": "**/install/**",
- "destination": "/install",
- "type": 301
- },
- {
- "source": "/page/install",
- "destination": "/install",
- "type": 301
- },
- {
- "source": "**/api-constructor/**",
- "destination": "/api-constructor",
- "type": 301
- },
- {
- "source": "**/api-input/**",
- "destination": "/api-input",
- "type": 301
- },
- {
- "source": "**/api-output/**",
- "destination": "/api-output",
- "type": 301
- },
- {
- "source": "**/api-resize/**",
- "destination": "/api-resize",
- "type": 301
- },
- {
- "source": "**/api-compsite/**",
- "destination": "/api-compsite",
- "type": 301
- },
- {
- "source": "**/api-operation/**",
- "destination": "/api-operation",
- "type": 301
- },
- {
- "source": "**/api-colour/**",
- "destination": "/api-colour",
- "type": 301
- },
- {
- "source": "**/api-channel/**",
- "destination": "/api-channel",
- "type": 301
- },
- {
- "source": "**/api-utility/**",
- "destination": "/api-utility",
- "type": 301
- },
- {
- "source": "/page/api",
- "destination": "/api-constructor",
- "type": 301
- },
- {
- "source": "**/performance/**",
- "destination": "/performance",
- "type": 301
- },
- {
- "source": "/page/performance",
- "destination": "/performance",
- "type": 301
- },
- {
- "source": "**/changelog/**",
- "destination": "/changelog",
- "type": 301
- },
- {
- "source": "/page/changelog",
- "destination": "/changelog",
- "type": 301
- },
- {
- "source": "/en/**",
- "destination": "/",
- "type": 301
- }
- ],
- "rewrites": [
- {
- "source": "**",
- "destination": "/index.html"
- }
]
}
}
diff --git a/docs/index.html b/docs/index.html
deleted file mode 100644
index 789f470e4..000000000
--- a/docs/index.html
+++ /dev/null
@@ -1,216 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- sharp - High performance Node.js image processing
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/install.md b/docs/install.md
deleted file mode 100644
index 051e924e3..000000000
--- a/docs/install.md
+++ /dev/null
@@ -1,240 +0,0 @@
-# Installation
-
-```sh
-npm install sharp
-```
-
-```sh
-yarn add sharp
-```
-
-## Prerequisites
-
-* Node.js v10+
-
-## Prebuilt binaries
-
-Ready-compiled sharp and libvips binaries are provided for use with
-Node.js v10+ on the most common platforms:
-
-* macOS x64 (>= 10.13)
-* Linux x64 (glibc >= 2.17, musl >= 1.1.24)
-* Linux ARM64 (glibc >= 2.29, musl >= 1.1.24)
-* Windows x64
-* Windows x86
-
-An ~7.5MB tarball containing libvips and its most commonly used dependencies
-is downloaded via HTTPS and stored within `node_modules/sharp/vendor` during `npm install`.
-
-This provides support for the
-JPEG, PNG, WebP, AVIF, TIFF, GIF (input) and SVG (input) image formats.
-
-The following platforms have prebuilt libvips but not sharp:
-
-* macOS ARM64
-* Linux ARMv6
-* Linux ARMv7 (glibc >= 2.28)
-* Windows ARM64
-
-The following platforms require compilation of both libvips and sharp from source:
-
-* Linux x86
-* Linux x64 (glibc <= 2.16, includes RHEL/CentOS 6)
-* Linux ARM64 (glibc <= 2.28)
-* Linux PowerPC
-* FreeBSD
-* OpenBSD
-
-## Common problems
-
-The architecture and platform of Node.js used for `npm install`
-must be the same as the architecture and platform of Node.js used at runtime.
-
-When using npm v6 or earlier, the `npm install --unsafe-perm` flag must be used when installing as `root` or a `sudo` user.
-
-When using npm v7, the user running `npm install` must own the directory it is run in.
-
-The `npm install --ignore-scripts=false` flag must be used when `npm` has been configured to ignore installation scripts.
-
-Check the output of running `npm install --verbose sharp` for useful error messages.
-
-## Apple M1
-
-Prebuilt libvips binaries are provided for macOS on ARM64 (since sharp v0.28.0).
-
-During `npm install` sharp will be built locally,
-which requires Xcode and Python - see
-[building from source](#building-from-source).
-
-When this new ARM64 CPU is made freely available
-to open source projects via a CI service
-then prebuilt sharp binaries can also be provided.
-
-## Custom libvips
-
-To use a custom, globally-installed version of libvips instead of the provided binaries,
-make sure it is at least the version listed under `config.libvips` in the `package.json` file
-and that it can be located using `pkg-config --modversion vips-cpp`.
-
-For help compiling libvips from source, please see
-[https://libvips.github.io/libvips/install.html#building-libvips-from-a-source-tarball](https://libvips.github.io/libvips/install.html#building-libvips-from-a-source-tarball).
-
-The use of a globally-installed libvips is unsupported on Windows.
-
-## Building from source
-
-This module will be compiled from source at `npm install` time when:
-
-* a globally-installed libvips is detected (set the `SHARP_IGNORE_GLOBAL_LIBVIPS` environment variable to skip this),
-* prebuilt sharp binaries do not exist for the current platform, or
-* when the `npm install --build-from-source` flag is used.
-
-Building from source requires:
-
-* C++11 compiler
-* [node-gyp](https://github.com/nodejs/node-gyp#installation) and its dependencies
-
-## Custom prebuilt binaries
-
-This is an advanced approach that most people will not require.
-
-To install the prebuilt sharp binaries from a custom URL,
-set the `sharp_binary_host` npm config option
-or the `npm_config_sharp_binary_host` environment variable.
-
-To install the prebuilt libvips binaries from a custom URL,
-set the `sharp_libvips_binary_host` npm config option
-or the `npm_config_sharp_libvips_binary_host` environment variable.
-
-The version subpath and file name are appended to these. There should be tarballs available
-that are compressed with both gzip and Brotli, as the format downloaded will vary depending
-on whether the user's version of Node supports Brotli decompression (Node.js v10.16.0+)
-
-For example, if `sharp_libvips_binary_host` is set to `https://hostname/path`
-and the libvips version is `1.2.3` then the resultant URL will be
-`https://hostname/path/v1.2.3/libvips-1.2.3-platform-arch.tar.br` or
-`https://hostname/path/v1.2.3/libvips-1.2.3-platform-arch.tar.gz`.
-
-See the Chinese mirror below for a further example.
-
-## Chinese mirror
-
-Alibaba provide a mirror site based in China containing binaries for both sharp and libvips.
-
-To use this either set the following configuration:
-
-```sh
-npm config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
-npm config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
-npm install sharp
-```
-
-or set the following environment variables:
-
-```sh
-npm_config_sharp_binary_host="https://npm.taobao.org/mirrors/sharp" \
- npm_config_sharp_libvips_binary_host="https://npm.taobao.org/mirrors/sharp-libvips" \
- npm install sharp
-```
-
-## FreeBSD
-
-The `vips` package must be installed before `npm install` is run.
-
-```sh
-pkg install -y pkgconf vips
-```
-
-```sh
-cd /usr/ports/graphics/vips/ && make install clean
-```
-
-## Linux memory allocator
-
-The default memory allocator on most glibc-based Linux systems
-(e.g. Debian, Red Hat) is unsuitable for long-running, multi-threaded
-processes that involve lots of small memory allocations.
-
-For this reason, by default, sharp will limit the use of thread-based
-[concurrency](api-utility#concurrency) when the glibc allocator is
-detected at runtime.
-
-To help avoid fragmentation and improve performance on these systems,
-the use of an alternative memory allocator such as
-[jemalloc](https://github.com/jemalloc/jemalloc) is recommended.
-
-Those using musl-based Linux (e.g. Alpine) and non-Linux systems are
-unaffected.
-
-## Heroku
-
-Add the
-[jemalloc buildpack](https://github.com/gaffneyc/heroku-buildpack-jemalloc)
-to reduce the effects of memory fragmentation.
-
-Set
-[NODE_MODULES_CACHE](https://devcenter.heroku.com/articles/nodejs-support#cache-behavior)
-to `false` when using the `yarn` package manager.
-
-## AWS Lambda
-
-The binaries in the `node_modules` directory of the
-[deployment package](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-package.html)
-must be for the Linux x64 platform.
-
-When building your deployment package on machines other than Linux x64 (glibc),
-run the following commands:
-
-macOS:
-```sh
-rm -rf node_modules/sharp
-SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux sharp
-```
-
-Windows:
-```sh
-rmdir /s /q node_modules/sharp
-npm install --arch=x64 --platform=linux sharp
-```
-
-Alternatively a Docker container closely matching the Lambda runtime can be used:
-
-```sh
-rm -rf node_modules/sharp
-docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm install sharp
-```
-
-To get the best performance select the largest memory available.
-A 1536 MB function provides ~12x more CPU time than a 128 MB function.
-
-## Webpack
-
-Ensure sharp is added to the
-[externals](https://webpack.js.org/configuration/externals/)
-configuration.
-
-```js
-externals: {
- 'sharp': 'commonjs sharp'
-}
-```
-
-## Worker threads
-
-The main thread must call `require('sharp')`
-before worker threads are created
-to ensure shared libraries remain loaded in memory
-until after all threads are complete.
-
-## Known conflicts
-
-### Canvas and Windows
-
-The prebuilt binaries provided by `canvas` for Windows depend on the unmaintained GTK 2, last updated in 2011.
-
-These conflict with the modern, up-to-date binaries provided by sharp.
-
-If both modules are used in the same Windows process, the following error will occur:
-```
-The specified procedure could not be found.
-```
diff --git a/docs/package.json b/docs/package.json
new file mode 100644
index 000000000..7eaa41943
--- /dev/null
+++ b/docs/package.json
@@ -0,0 +1,18 @@
+{
+ "name": "sharp-docs",
+ "type": "module",
+ "version": "0.0.1",
+ "private": true,
+ "scripts": {
+ "dev": "astro dev",
+ "start": "astro dev",
+ "build": "astro build",
+ "preview": "astro preview",
+ "astro": "astro"
+ },
+ "dependencies": {
+ "@astrojs/starlight": "^0.36.2",
+ "astro": "^5.15.3",
+ "starlight-auto-sidebar": "^0.1.3"
+ }
+}
diff --git a/docs/performance.md b/docs/performance.md
deleted file mode 100644
index 2d8834cb9..000000000
--- a/docs/performance.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# Performance
-
-A test to benchmark the performance of this module relative to alternatives.
-
-## The contenders
-
-* [jimp](https://www.npmjs.com/package/jimp) v0.16.1 - Image processing in pure JavaScript. Provides bicubic interpolation.
-* [mapnik](https://www.npmjs.org/package/mapnik) v4.5.6 - Whilst primarily a map renderer, Mapnik contains bitmap image utilities.
-* [imagemagick](https://www.npmjs.com/package/imagemagick) v0.1.3 - Supports filesystem only and "*has been unmaintained for a long time*".
-* [gm](https://www.npmjs.com/package/gm) v1.23.1 - Fully featured wrapper around GraphicsMagick's `gm` command line utility.
-* sharp v0.28.0 / libvips v8.10.6 - Caching within libvips disabled to ensure a fair comparison.
-
-## The task
-
-Decompress a 2725x2225 JPEG image,
-resize to 720x588 using Lanczos 3 resampling (where available),
-then compress to JPEG at a "quality" setting of 80.
-
-## Test environment
-
-* AWS EC2 eu-west-1 [c5ad.xlarge](https://aws.amazon.com/ec2/instance-types/c5/) (4x AMD EPYC 7R32)
-* Ubuntu 20.10 (ami-03f10415e8b0bfb86)
-* Node.js v14.16.0
-
-## Results
-
-| Module | Input | Output | Ops/sec | Speed-up |
-| :----------------- | :----- | :----- | ------: | -------: |
-| jimp | buffer | buffer | 0.78 | 1.0 |
-| mapnik | buffer | buffer | 3.39 | 4.3 |
-| gm | buffer | buffer | 7.84 | 10.1 |
-| gm | file | file | 9.24 | 11.8 |
-| imagemagick | file | file | 9.37 | 12.0 |
-| sharp | stream | stream | 26.84 | 34.4 |
-| sharp | file | file | 29.76 | 38.2 |
-| sharp | buffer | buffer | 31.60 | 40.5 |
-
-Greater libvips performance can be expected with caching enabled (default)
-and using 8+ core machines, especially those with larger L1/L2 CPU caches.
-
-The I/O limits of the relevant (de)compression library will generally determine maximum throughput.
-
-## Running the benchmark test
-
-Requires _ImageMagick_, _GraphicsMagick_ and _Mapnik_:
-
-```sh
-brew install imagemagick
-brew install graphicsmagick
-brew install mapnik
-```
-
-```sh
-sudo apt-get install build-essential imagemagick libmagick++-dev graphicsmagick libmapnik-dev
-```
-
-```sh
-sudo yum install ImageMagick-devel ImageMagick-c++-devel GraphicsMagick mapnik-devel
-```
-
-```sh
-git clone https://github.com/lovell/sharp.git
-cd sharp
-npm install --build-from-source
-cd test/bench
-npm install
-npm test
-```
diff --git a/docs/public/api-resize-fit.svg b/docs/public/api-resize-fit.svg
new file mode 100644
index 000000000..9227a0d2f
--- /dev/null
+++ b/docs/public/api-resize-fit.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/docs/image/sharp-logo.svg b/docs/public/favicon.svg
similarity index 100%
rename from docs/image/sharp-logo.svg
rename to docs/public/favicon.svg
diff --git a/docs/humans.txt b/docs/public/humans.txt
similarity index 64%
rename from docs/humans.txt
rename to docs/public/humans.txt
index 3ec1bdb22..7119152ab 100644
--- a/docs/humans.txt
+++ b/docs/public/humans.txt
@@ -28,7 +28,7 @@ Name: Brandon Aaron
GitHub: https://github.com/brandonaaron
Name: Andreas Lind
-GitHub: https://github.com/papandreouGitHub:
+GitHub: https://github.com/papandreou
Name: Maurus Cuelenaere
GitHub: https://github.com/mcuelenaere
@@ -209,3 +209,120 @@ GitHub: https://github.com/beig
Name: Florian Busch
GitHub: https://github.com/florian-busch
+
+Name: Matthieu Salettes
+GitHub: https://github.com/msalettes
+
+Name: Taneli Vatanen
+GitHub: https://github.com/Daiz
+
+Name: Mart Jansink
+GitHub: https://github.com/mart-jansink
+
+Name: Tenpi
+GitHub: https://github.com/Tenpi
+
+Name: Zaruike
+GitHub: https://github.com/Zaruike
+
+Name: Erlend F
+GitHub: https://github.com/erf
+
+Name: Drian Naude
+GitHub: https://github.com/driannaude
+
+Name: Max Gordon
+GitHub: https://github.com/gforge
+
+Name: Chris Banks
+GitHub: https://github.com/christopherbradleybanks
+
+Name: codepage949
+GitHub: https://github.com/codepage949
+
+Name: Chris Hranj
+GitHub: https://github.com/Brodan
+
+Name: Ankur Parihar
+GitHub: https://github.com/ankurparihar
+
+Name: Joona Heinikoski
+GitHub: https://github.com/joonamo
+
+Name: AlexanderTheGrey
+GitHub: https://github.com/AlexanderTheGrey
+
+Name: Blayne Chard
+GitHub: https://github.com/blacha
+
+Name: Brahim
+GitHub: https://github.com/brahima
+
+Name: Anton Marsden
+GitHub: https://github.com/antonmarsden
+
+Name: Marcos Casagrande
+GitHub: https://github.com/marcosc90
+
+Name: Emanuel Jöbstl
+GitHub: https://github.com/ejoebstl
+
+Name: Tomasz Janowski
+GitHub: https://github.com/janaz
+
+Name: Lachlan Newman
+GitHub: https://github.com/LachlanNewman
+
+Name: BJJ
+GitHub: https://github.com/bianjunjie1981
+
+Name: Dennis Beatty
+GitHub: https://github.com/dnsbty
+
+Name: Ingvar Stepanyan
+GitHub: https://github.com/RReverser
+
+Name: Tamás András Horváth
+GitHub: https://github.com/icetee
+
+Name: Aaron Che
+GitHub: https://github.com/yolopunk
+
+Name: Mert Alev
+GitHub: https://github.com/mertalev
+
+Name: Adriaan Meuris
+GitHub: https://github.com/adriaanmeuris
+
+Name: Richard Hillmann
+GitHub: https://github.com/project0
+
+Name: Pongsatorn Manusopit
+GitHub: https://github.com/ton11797
+
+Name: Nathan Keynes
+GitHub: https://github.com/nkeynes
+
+Name: Sumit D
+GitHub: https://github.com/sumitd2
+
+Name: Caleb Meredith
+GitHub: https://github.com/calebmer
+
+Name: Don Denton
+GitHub: https://github.com/happycollision
+
+Name: Florent Zabera
+GitHub: https://github.com/florentzabera
+
+Name: Quentin Pinçon
+GitHub: https://github.com/qpincon
+
+Name: Hans Chen
+GitHub: https://github.com/hans00
+
+Name: Thibaut Patel
+GitHub: https://github.com/tpatel
+
+Name: Maël Nison
+GitHub: https://github.com/arcanis
diff --git a/docs/public/robots.txt b/docs/public/robots.txt
new file mode 100644
index 000000000..a829753d9
--- /dev/null
+++ b/docs/public/robots.txt
@@ -0,0 +1,4 @@
+User-agent: *
+Disallow:
+
+Sitemap: https://sharp.pixelplumbing.com/sitemap-index.xml
diff --git a/docs/image/sharp-logo-mono.svg b/docs/public/sharp-logo-mono.svg
similarity index 100%
rename from docs/image/sharp-logo-mono.svg
rename to docs/public/sharp-logo-mono.svg
diff --git a/docs/public/sharp-logo.svg b/docs/public/sharp-logo.svg
new file mode 100644
index 000000000..fc185469f
--- /dev/null
+++ b/docs/public/sharp-logo.svg
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/docs/robots.txt b/docs/robots.txt
deleted file mode 100644
index 6f27bb66a..000000000
--- a/docs/robots.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-User-agent: *
-Disallow:
\ No newline at end of file
diff --git a/docs/search-index.json b/docs/search-index.json
deleted file mode 100644
index 2f0138c8e..000000000
--- a/docs/search-index.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"t":"Prerequisites","d":"Node.js v10","k":"prerequisites node","l":"/install#prerequisites"},{"t":"Prebuilt binaries","d":"Ready-compiled sharp and libvips binaries are provided for use with Node.js v10 on the most common platforms macOS x64 10.13 Linux x64 glibc 2.17, musl 1.1.24 Linux ARM64 glibc 2.2","k":"prebuilt binaries compiled sharp libvips node common platforms macos linux glibc musl arm","l":"/install#prebuilt-binaries"},{"t":"Common problems","d":"The architecture and platform of Node.js used for npm install must be the same as the architecture and platform of Node.js used at runtime. When using npm v6 or earlier, the npm in","k":"common problems architecture platform node npm install runtime earlier","l":"/install#common-problems"},{"t":"Apple M1","d":"Prebuilt libvips binaries are provided for macOS on ARM64 since sharp v0.28.0. During npm install sharp will be built locally, which requires Xcode and Python - see building from s","k":"apple prebuilt libvips binaries macos arm sharp during npm install built locally requires xcode python building","l":"/install#apple-m1"},{"t":"Custom libvips","d":"To use a custom, globally-installed version of libvips instead of the provided binaries, make sure it is at least the version listed under config.libvips in the package.json file a","k":"custom libvips globally installed version instead binaries make listed config package json file","l":"/install#custom-libvips"},{"t":"Building from source","d":"This module will be compiled from source at npm install time when a globally-installed libvips is detected set the SHARP_IGNORE_GLOBAL_LIBVIPS environment variable to skip this, pr","k":"building source module compiled npm install time globally installed libvips detected environment variable skip","l":"/install#building-from-source"},{"t":"Custom prebuilt binaries","d":"This is an advanced approach that most people will not require. To install the prebuilt sharp binaries from a custom URL, set the sharp_binary_host npm config option or the npm_con","k":"custom prebuilt binaries advanced approach people require install sharp url npm config option npmcon","l":"/install#custom-prebuilt-binaries"},{"t":"Chinese mirror","d":"Alibaba provide a mirror site based in China containing binaries for both sharp and libvips. To use this either set the following configuration sh npm config set sharp_binary_host","k":"chinese mirror alibaba site china binaries sharp libvips following configuration npm config","l":"/install#chinese-mirror"},{"t":"FreeBSD","d":"The vips package must be installed before npm install is run. sh pkg install -y pkgconf vips sh cd /usr/ports/graphics/vips/ make install clean","k":"freebsd vips package installed npm install run pkg pkgconf usr ports graphics make clean","l":"/install#freebsd"},{"t":"Linux memory allocator","d":"The default memory allocator on most glibc-based Linux systems e.g. Debian, Red Hat is unsuitable for long-running, multi-threaded processes that involve lots of small memory alloc","k":"linux memory allocator glibc systems debian red hat unsuitable long running multi threaded processes small alloc","l":"/install#linux-memory-allocator"},{"t":"Heroku","d":"Add the jemalloc buildpack to reduce the effects of memory fragmentation. Set NODE_MODULES_CACHE","k":"heroku add jemalloc buildpack reduce effects memory fragmentation","l":"/install#heroku"},{"t":"AWS Lambda","d":"Set the Lambda runtime to nodejs12.x. The binaries in the node_modules directory of the deployment package must be for the Linux x64 platform. When building your deployment package","k":"aws lambda runtime nodejs binaries nodemodules directory deployment package linux platform building your","l":"/install#aws-lambda"},{"t":"Webpack","d":"Ensure sharp is added to the externals configuration. js externals sharp commonjs sharp","k":"webpack sharp added externals configuration commonjs","l":"/install#webpack"},{"t":"Worker threads","d":"The main thread must call requiresharp before worker threads are created to ensure shared libraries remain loaded in memory until after all threads are complete.","k":"worker threads main thread requiresharp created shared libraries remain loaded memory complete","l":"/install#worker-threads"},{"t":"Canvas and Windows","d":"The prebuilt binaries provided by canvas for Windows depend on the unmaintained GTK 2, last updated in 2011. These conflict with the modern, up-to-date binaries provided by sharp.","k":"canvas windows prebuilt binaries depend unmaintained gtk last updated conflict modern date sharp","l":"/install#canvas-and-windows"},{"t":"Sharp","d":"Constructor factory to create an instance of sharp, to which further methods are chained.","k":"sharp constructor factory create instance further methods chained","l":"/api-constructor#sharp"},{"t":"clone","d":"Take a snapshot of the Sharp instance, returning a new instance. Cloned instances inherit the input of their parent instance. This allows multiple output Streams and therefore mult","k":"clone snapshot sharp instance returning new cloned instances inherit input parent multiple output streams mult","l":"/api-constructor#clone"},{"t":"metadata","d":"Fast access to uncached image metadata without decoding any compressed image data. A Promise is returned when callback is not provided.","k":"metadata fast access uncached decoding compressed data promise returned callback","l":"/api-input#metadata"},{"t":"stats","d":"Access to pixel-derived image statistics for every channel in the image. A Promise is returned when callback is not provided.","k":"stats access pixel derived statistics channel promise returned callback","l":"/api-input#stats"},{"t":"toFile","d":"Write output image data to a file.","k":"tofile write output data file","l":"/api-output#tofile"},{"t":"toBuffer","d":"Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF and raw pixel data output are supported.","k":"tobuffer write output buffer jpeg png webp avif tiff raw pixel data","l":"/api-output#tobuffer"},{"t":"withMetadata","d":"Include all metadata EXIF, XMP, IPTC from the input image in the output image. This will also convert to and add a web-friendly sRGB ICC profile unless a custom output profile is p","k":"withmetadata include metadata exif xmp iptc input output convert add web friendly srgb icc profile custom","l":"/api-output#withmetadata"},{"t":"toFormat","d":"Force output to a given format.","k":"toformat force output format","l":"/api-output#toformat"},{"t":"jpeg","d":"Use these JPEG options for output image.","k":"jpeg output","l":"/api-output#jpeg"},{"t":"png","d":"Use these PNG options for output image.","k":"png output","l":"/api-output#png"},{"t":"webp","d":"Use these WebP options for output image.","k":"webp output","l":"/api-output#webp"},{"t":"gif","d":"Use these GIF options for output image.","k":"gif output","l":"/api-output#gif"},{"t":"tiff","d":"Use these TIFF options for output image.","k":"tiff output","l":"/api-output#tiff"},{"t":"avif","d":"Use these AVIF options for output image.","k":"avif output","l":"/api-output#avif"},{"t":"heif","d":"Use these HEIF options for output image.","k":"heif output","l":"/api-output#heif"},{"t":"raw","d":"Force output to be raw, uncompressed, 8-bit unsigned integer unit8 pixel data. Pixel ordering is left-to-right, top-to-bottom, without padding. Channel ordering will be RGB or RGBA","k":"raw force output uncompressed bit unsigned integer unit pixel data ordering left right top bottom padding channel rgb rgba","l":"/api-output#raw"},{"t":"tile","d":"Use tile-based deep zoom image pyramid output. Set the format and options for tile images via the toFormat, jpeg, png or webp functions. Use a .zip or .szi file extension with toFi","k":"tile deep zoom pyramid output format images via toformat jpeg png webp functions zip szi file extension tofi","l":"/api-output#tile"},{"t":"resize","d":"Resize image to width, height or width x height.","k":"resize width height","l":"/api-resize#resize"},{"t":"extend","d":"Extends/pads the edges of the image with the provided background colour. This operation will always occur after resizing and extraction, if any.","k":"extend extends pads edges background colour operation resizing extraction","l":"/api-resize#extend"},{"t":"extract","d":"Extract/crop a region of the image.","k":"extract crop region","l":"/api-resize#extract"},{"t":"trim","d":"Trim boring pixels from all edges that contain values similar to the top-left pixel. Images consisting entirely of a single colour will calculate boring using the alpha channel, if","k":"trim boring pixels edges contain similar top left pixel images consisting entirely single colour calculate alpha channel","l":"/api-resize#trim"},{"t":"composite","d":"Composite images over the processed resized, extracted etc. image.","k":"composite images processed resized extracted","l":"/api-composite#composite"},{"t":"rotate","d":"Rotate the output image by either an explicit angle or auto-orient based on the EXIF Orientation tag.","k":"rotate output explicit angle auto orient exif orientation tag","l":"/api-operation#rotate"},{"t":"flip","d":"Flip the image about the vertical Y axis. This always occurs after rotation, if any. The use of flip implies the removal of the EXIF Orientation tag, if any.","k":"flip vertical axis rotation implies removal exif orientation tag","l":"/api-operation#flip"},{"t":"flop","d":"Flop the image about the horizontal X axis. This always occurs after rotation, if any. The use of flop implies the removal of the EXIF Orientation tag, if any.","k":"flop horizontal axis rotation implies removal exif orientation tag","l":"/api-operation#flop"},{"t":"affine","d":"Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.","k":"affine transform operation resizing extraction rotation","l":"/api-operation#affine"},{"t":"sharpen","d":"Sharpen the image. When used without parameters, performs a fast, mild sharpen of the output image. When a sigma is provided, performs a slower, more accurate sharpen of the L chan","k":"sharpen parameters fast mild output sigma slower accurate chan","l":"/api-operation#sharpen"},{"t":"median","d":"Apply median filter. When used without parameters the default window is 3x3.","k":"median apply filter parameters window","l":"/api-operation#median"},{"t":"blur","d":"Blur the image. When used without parameters, performs a fast, mild blur of the output image. When a sigma is provided, performs a slower, more accurate Gaussian blur.","k":"blur parameters fast mild output sigma slower accurate gaussian","l":"/api-operation#blur"},{"t":"flatten","d":"Merge alpha transparency channel, if any, with a background, then remove the alpha channel.","k":"flatten merge alpha transparency channel background then remove","l":"/api-operation#flatten"},{"t":"gamma","d":"Apply a gamma correction by reducing the encoding darken pre-resize at a factor of 1/gamma then increasing the encoding brighten post-resize at a factor of gamma. This can improve","k":"gamma apply correction reducing encoding darken pre resize factor then increasing brighten post improve","l":"/api-operation#gamma"},{"t":"negate","d":"Produce the negative of the image.","k":"negate produce negative","l":"/api-operation#negate"},{"t":"normalise","d":"Enhance output image contrast by stretching its luminance to cover the full dynamic range.","k":"normalise enhance output contrast stretching luminance cover full dynamic range","l":"/api-operation#normalise"},{"t":"normalize","d":"Alternative spelling of normalise.","k":"normalize normalise","l":"/api-operation#normalize"},{"t":"convolve","d":"Convolve the image with the specified kernel.","k":"convolve specified kernel","l":"/api-operation#convolve"},{"t":"threshold","d":"Any pixel value greater than or equal to the threshold value will be set to 255, otherwise it will be set to 0.","k":"threshold pixel greater than equal otherwise","l":"/api-operation#threshold"},{"t":"boolean","d":"Perform a bitwise boolean operation with operand image.","k":"boolean bitwise operation operand","l":"/api-operation#boolean"},{"t":"linear","d":"Apply the linear formula a input b to the image levels adjustment","k":"linear apply formula input levels adjustment","l":"/api-operation#linear"},{"t":"recomb","d":"Recomb the image with the specified matrix.","k":"recomb specified matrix","l":"/api-operation#recomb"},{"t":"modulate","d":"Transforms the image using brightness, saturation and hue rotation.","k":"modulate transforms brightness saturation hue rotation","l":"/api-operation#modulate"},{"t":"removeAlpha","d":"Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel.","k":"removealpha remove alpha channel","l":"/api-channel#removealpha"},{"t":"ensureAlpha","d":"Ensure alpha channel, if missing. The added alpha channel will be fully opaque. This is a no-op if the image already has an alpha channel.","k":"ensurealpha alpha channel missing added fully opaque","l":"/api-channel#ensurealpha"},{"t":"extractChannel","d":"Extract a single channel from a multi-channel image.","k":"extractchannel extract single channel multi","l":"/api-channel#extractchannel"},{"t":"joinChannel","d":"Join one or more channels to the image. The meaning of the added channels depends on the output colourspace, set with toColourspace. By default the output image will be web-friendl","k":"joinchannel join one channels meaning added depends output colourspace tocolourspace web friendl","l":"/api-channel#joinchannel"},{"t":"bandbool","d":"Perform a bitwise boolean operation on all input image channels bands to produce a single channel output image.","k":"bandbool bitwise boolean operation input channels bands produce single channel output","l":"/api-channel#bandbool"},{"t":"tint","d":"Tint the image using the provided chroma while preserving the image luminance. An alpha channel may be present and will be unchanged by the operation.","k":"tint chroma preserving luminance alpha channel present unchanged operation","l":"/api-colour#tint"},{"t":"greyscale","d":"Convert to 8-bit greyscale 256 shades of grey. This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use gamma with greyscale for the best re","k":"greyscale convert bit shades grey linear operation input colour space srgb gamma best","l":"/api-colour#greyscale"},{"t":"grayscale","d":"Alternative spelling of greyscale.","k":"grayscale greyscale","l":"/api-colour#grayscale"},{"t":"toColourspace","d":"Set the output colourspace. By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.","k":"tocolourspace output colourspace web friendly srgb additional channels interpreted alpha","l":"/api-colour#tocolourspace"},{"t":"toColorspace","d":"Alternative spelling of toColourspace.","k":"tocolorspace tocolourspace","l":"/api-colour#tocolorspace"},{"t":"format","d":"An Object containing nested boolean values representing the available input and output formats/methods.","k":"format object nested boolean representing available input output formats methods","l":"/api-utility#format"},{"t":"interpolators","d":"An Object containing the available interpolators and their proper values","k":"interpolators object available proper","l":"/api-utility#interpolators"},{"t":"versions","d":"An Object containing the version numbers of libvips and its dependencies.","k":"versions object version numbers libvips dependencies","l":"/api-utility#versions"},{"t":"cache","d":"Gets or, when options are provided, sets the limits of _libvips_ operation cache. Existing entries in the cache will be trimmed after any change in limits. This method always retur","k":"cache limits libvips operation existing entries trimmed change method retur","l":"/api-utility#cache"},{"t":"concurrency","d":"Gets or, when a concurrency is provided, sets the number of threads _libvips_ should create to process each image.","k":"concurrency number threads libvips create process","l":"/api-utility#concurrency"},{"t":"queue","d":"An EventEmitter that emits a change event when a task is either","k":"queue eventemitter emits change event task","l":"/api-utility#queue"},{"t":"counters","d":"Provides access to internal task counters.","k":"counters provides access internal task","l":"/api-utility#counters"},{"t":"simd","d":"Get and set use of SIMD vector unit instructions. Requires libvips to have been compiled with liborc support.","k":"simd vector unit instructions requires libvips compiled liborc","l":"/api-utility#simd"}]
\ No newline at end of file
diff --git a/docs/search-index/build.js b/docs/search-index/build.js
deleted file mode 100644
index f8f2d673b..000000000
--- a/docs/search-index/build.js
+++ /dev/null
@@ -1,60 +0,0 @@
-'use strict';
-
-const fs = require('fs');
-const path = require('path');
-const { extractDescription, extractKeywords } = require('./extract');
-
-const searchIndex = [];
-
-// Install
-const contents = fs.readFileSync(path.join(__dirname, '..', 'install.md'), 'utf8');
-const matches = contents.matchAll(
- /## (?[A-Za-z0-9 ]+)\n\n(?[^#]+)/gs
-);
-for (const match of matches) {
- const { title, body } = match.groups;
- const description = extractDescription(body);
-
- searchIndex.push({
- t: title,
- d: description,
- k: extractKeywords(`${title} ${description}`),
- l: `/install#${title.toLowerCase().replace(/ /g, '-')}`
- });
-}
-
-// API
-[
- 'constructor',
- 'input',
- 'output',
- 'resize',
- 'composite',
- 'operation',
- 'channel',
- 'colour',
- 'utility'
-].forEach((section) => {
- const contents = fs.readFileSync(path.join(__dirname, '..', `api-${section}.md`), 'utf8');
- const matches = contents.matchAll(
- /\n## (?[A-Za-z]+)\n\n(?.+?)\n\n/gs
- );
- for (const match of matches) {
- const { title, firstparagraph } = match.groups;
- const description = firstparagraph.startsWith('###')
- ? 'Constructor'
- : extractDescription(firstparagraph);
-
- searchIndex.push({
- t: title,
- d: description,
- k: extractKeywords(`${title} ${description}`),
- l: `/api-${section}#${title.toLowerCase()}`
- });
- }
-});
-
-fs.writeFileSync(
- path.join(__dirname, '..', 'search-index.json'),
- JSON.stringify(searchIndex)
-);
diff --git a/docs/search-index/extract.js b/docs/search-index/extract.js
deleted file mode 100644
index 4d97f2905..000000000
--- a/docs/search-index/extract.js
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict';
-
-const stopWords = require('./stop-words');
-
-const extractDescription = (str) =>
- str
- .replace(/\(http[^)]+/g, '')
- .replace(/\s+/g, ' ')
- .replace(/[^A-Za-z0-9_/\-,. ]/g, '')
- .replace(/\s+/g, ' ')
- .substr(0, 180)
- .trim();
-
-const extractKeywords = (str) =>
- [
- ...new Set(
- str
- .split(/[ -/]/)
- .map((word) => word.toLowerCase().replace(/[^a-z]/g, ''))
- .filter((word) => word.length > 2 && word.length < 15 && !stopWords.includes(word))
- )
- ].join(' ');
-
-module.exports = { extractDescription, extractKeywords };
diff --git a/docs/search-index/stop-words.js b/docs/search-index/stop-words.js
deleted file mode 100644
index 0a777fbce..000000000
--- a/docs/search-index/stop-words.js
+++ /dev/null
@@ -1,92 +0,0 @@
-'use strict';
-
-module.exports = [
- 'about',
- 'after',
- 'all',
- 'allows',
- 'already',
- 'also',
- 'alternative',
- 'always',
- 'and',
- 'any',
- 'are',
- 'based',
- 'been',
- 'before',
- 'both',
- 'call',
- 'can',
- 'containing',
- 'default',
- 'does',
- 'each',
- 'either',
- 'ensure',
- 'etc',
- 'every',
- 'for',
- 'from',
- 'get',
- 'gets',
- 'given',
- 'has',
- 'have',
- 'how',
- 'image',
- 'involve',
- 'its',
- 'least',
- 'lots',
- 'may',
- 'more',
- 'most',
- 'much',
- 'must',
- 'non',
- 'not',
- 'occur',
- 'occurs',
- 'options',
- 'over',
- 'perform',
- 'performs',
- 'provide',
- 'provided',
- 'ready',
- 'same',
- 'see',
- 'set',
- 'sets',
- 'should',
- 'since',
- 'spelling',
- 'such',
- 'support',
- 'supported',
- 'sure',
- 'take',
- 'that',
- 'the',
- 'their',
- 'there',
- 'therefore',
- 'these',
- 'this',
- 'under',
- 'unless',
- 'until',
- 'use',
- 'used',
- 'using',
- 'value',
- 'values',
- 'when',
- 'which',
- 'while',
- 'will',
- 'with',
- 'without',
- 'you'
-];
diff --git a/docs/src/assets/sharp-logo.svg b/docs/src/assets/sharp-logo.svg
new file mode 100644
index 000000000..fc185469f
--- /dev/null
+++ b/docs/src/assets/sharp-logo.svg
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/docs/src/content.config.ts b/docs/src/content.config.ts
new file mode 100644
index 000000000..06cf12929
--- /dev/null
+++ b/docs/src/content.config.ts
@@ -0,0 +1,10 @@
+import { defineCollection } from 'astro:content';
+import { docsLoader } from '@astrojs/starlight/loaders';
+import { docsSchema } from '@astrojs/starlight/schema';
+import { autoSidebarLoader } from 'starlight-auto-sidebar/loader'
+import { autoSidebarSchema } from 'starlight-auto-sidebar/schema'
+
+export const collections = {
+ docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
+ autoSidebar: defineCollection({ loader: autoSidebarLoader(), schema: autoSidebarSchema() })
+};
diff --git a/docs/src/content/docs/api-channel.md b/docs/src/content/docs/api-channel.md
new file mode 100644
index 000000000..214e8611d
--- /dev/null
+++ b/docs/src/content/docs/api-channel.md
@@ -0,0 +1,143 @@
+---
+# This file was auto-generated from JSDoc in lib/channel.js
+title: Channel manipulation
+---
+
+## removeAlpha
+> removeAlpha() ⇒ Sharp
+
+Remove alpha channels, if any. This is a no-op if the image does not have an alpha channel.
+
+See also [flatten](/api-operation/#flatten).
+
+
+**Example**
+```js
+sharp('rgba.png')
+ .removeAlpha()
+ .toFile('rgb.png', function(err, info) {
+ // rgb.png is a 3 channel image without an alpha channel
+ });
+```
+
+
+## ensureAlpha
+> ensureAlpha([alpha]) ⇒ Sharp
+
+Ensure the output image has an alpha transparency channel.
+If missing, the added alpha channel will have the specified
+transparency level, defaulting to fully-opaque (1).
+This is a no-op if the image already has an alpha channel.
+
+
+**Throws**:
+
+- Error Invalid alpha transparency level
+
+**Since**: 0.21.2
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [alpha] | number | 1 | alpha transparency level (0=fully-transparent, 1=fully-opaque) |
+
+**Example**
+```js
+// rgba.png will be a 4 channel image with a fully-opaque alpha channel
+await sharp('rgb.jpg')
+ .ensureAlpha()
+ .toFile('rgba.png')
+```
+**Example**
+```js
+// rgba is a 4 channel image with a fully-transparent alpha channel
+const rgba = await sharp(rgb)
+ .ensureAlpha(0)
+ .toBuffer();
+```
+
+
+## extractChannel
+> extractChannel(channel) ⇒ Sharp
+
+Extract a single channel from a multi-channel image.
+
+The output colourspace will be either `b-w` (8-bit) or `grey16` (16-bit).
+
+
+**Throws**:
+
+- Error Invalid channel
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| channel | number \| string | zero-indexed channel/band number to extract, or `red`, `green`, `blue` or `alpha`. |
+
+**Example**
+```js
+// green.jpg is a greyscale image containing the green channel of the input
+await sharp(input)
+ .extractChannel('green')
+ .toFile('green.jpg');
+```
+**Example**
+```js
+// red1 is the red value of the first pixel, red2 the second pixel etc.
+const [red1, red2, ...] = await sharp(input)
+ .extractChannel(0)
+ .raw()
+ .toBuffer();
+```
+
+
+## joinChannel
+> joinChannel(images, options) ⇒ Sharp
+
+Join one or more channels to the image.
+The meaning of the added channels depends on the output colourspace, set with `toColourspace()`.
+By default the output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
+Channel ordering follows vips convention:
+- sRGB: 0: Red, 1: Green, 2: Blue, 3: Alpha.
+- CMYK: 0: Magenta, 1: Cyan, 2: Yellow, 3: Black, 4: Alpha.
+
+Buffers may be any of the image formats supported by sharp.
+For raw pixel input, the `options` object should contain a `raw` attribute, which follows the format of the attribute of the same name in the `sharp()` constructor.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| images | Array.<(string\|Buffer)> \| string \| Buffer | one or more images (file paths, Buffers). |
+| options | Object | image options, see `sharp()` constructor. |
+
+
+
+## bandbool
+> bandbool(boolOp) ⇒ Sharp
+
+Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| boolOp | string | one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively. |
+
+**Example**
+```js
+sharp('3-channel-rgb-input.png')
+ .bandbool(sharp.bool.and)
+ .toFile('1-channel-output.png', function (err, info) {
+ // The output will be a single channel image where each pixel `P = R & G & B`.
+ // If `I(1,1) = [247, 170, 14] = [0b11110111, 0b10101010, 0b00001111]`
+ // then `O(1,1) = 0b11110111 & 0b10101010 & 0b00001111 = 0b00000010 = 2`.
+ });
+```
\ No newline at end of file
diff --git a/docs/src/content/docs/api-colour.md b/docs/src/content/docs/api-colour.md
new file mode 100644
index 000000000..6fb81debd
--- /dev/null
+++ b/docs/src/content/docs/api-colour.md
@@ -0,0 +1,150 @@
+---
+# This file was auto-generated from JSDoc in lib/colour.js
+title: Colour manipulation
+---
+
+## tint
+> tint(tint) ⇒ Sharp
+
+Tint the image using the provided colour.
+An alpha channel may be present and will be unchanged by the operation.
+
+
+**Throws**:
+
+- Error Invalid parameter
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| tint | string \| Object | Parsed by the [color](https://www.npmjs.org/package/color) module. |
+
+**Example**
+```js
+const output = await sharp(input)
+ .tint({ r: 255, g: 240, b: 16 })
+ .toBuffer();
+```
+
+
+## greyscale
+> greyscale([greyscale]) ⇒ Sharp
+
+Convert to 8-bit greyscale; 256 shades of grey.
+This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
+By default the output image will be web-friendly sRGB and contain three (identical) colour channels.
+This may be overridden by other sharp operations such as `toColourspace('b-w')`,
+which will produce an output image containing one colour channel.
+An alpha channel may be present, and will be unchanged by the operation.
+
+
+
+| Param | Type | Default |
+| --- | --- | --- |
+| [greyscale] | Boolean | true |
+
+**Example**
+```js
+const output = await sharp(input).greyscale().toBuffer();
+```
+
+
+## grayscale
+> grayscale([grayscale]) ⇒ Sharp
+
+Alternative spelling of `greyscale`.
+
+
+
+| Param | Type | Default |
+| --- | --- | --- |
+| [grayscale] | Boolean | true |
+
+
+
+## pipelineColourspace
+> pipelineColourspace([colourspace]) ⇒ Sharp
+
+Set the pipeline colourspace.
+
+The input image will be converted to the provided colourspace at the start of the pipeline.
+All operations will use this colourspace before converting to the output colourspace,
+as defined by [toColourspace](#tocolourspace).
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+**Since**: 0.29.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [colourspace] | string | pipeline colourspace e.g. `rgb16`, `scrgb`, `lab`, `grey16` [...](https://www.libvips.org/API/current/enum.Interpretation.html) |
+
+**Example**
+```js
+// Run pipeline in 16 bits per channel RGB while converting final result to 8 bits per channel sRGB.
+await sharp(input)
+ .pipelineColourspace('rgb16')
+ .toColourspace('srgb')
+ .toFile('16bpc-pipeline-to-8bpc-output.png')
+```
+
+
+## pipelineColorspace
+> pipelineColorspace([colorspace]) ⇒ Sharp
+
+Alternative spelling of `pipelineColourspace`.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [colorspace] | string | pipeline colorspace. |
+
+
+
+## toColourspace
+> toColourspace([colourspace]) ⇒ Sharp
+
+Set the output colourspace.
+By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [colourspace] | string | output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://www.libvips.org/API/current/enum.Interpretation.html) |
+
+**Example**
+```js
+// Output 16 bits per pixel RGB
+await sharp(input)
+ .toColourspace('rgb16')
+ .toFile('16-bpp.png')
+```
+
+
+## toColorspace
+> toColorspace([colorspace]) ⇒ Sharp
+
+Alternative spelling of `toColourspace`.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [colorspace] | string | output colorspace. |
\ No newline at end of file
diff --git a/docs/src/content/docs/api-composite.md b/docs/src/content/docs/api-composite.md
new file mode 100644
index 000000000..d4f9b8550
--- /dev/null
+++ b/docs/src/content/docs/api-composite.md
@@ -0,0 +1,103 @@
+---
+# This file was auto-generated from JSDoc in lib/composite.js
+title: Compositing images
+---
+
+## composite
+> composite(images) ⇒ Sharp
+
+Composite image(s) over the processed (resized, extracted etc.) image.
+
+The images to composite must be the same size or smaller than the processed image.
+If both `top` and `left` options are provided, they take precedence over `gravity`.
+
+Other operations in the same processing pipeline (e.g. resize, rotate, flip,
+flop, extract) will always be applied to the input image before composition.
+
+The `blend` option can be one of `clear`, `source`, `over`, `in`, `out`, `atop`,
+`dest`, `dest-over`, `dest-in`, `dest-out`, `dest-atop`,
+`xor`, `add`, `saturate`, `multiply`, `screen`, `overlay`, `darken`, `lighten`,
+`colour-dodge`, `color-dodge`, `colour-burn`,`color-burn`,
+`hard-light`, `soft-light`, `difference`, `exclusion`.
+
+More information about blend modes can be found at
+https://www.libvips.org/API/current/enum.BlendMode.html
+and https://www.cairographics.org/operators/
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+**Since**: 0.22.0
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| images | Array.<Object> | | Ordered list of images to composite |
+| [images[].input] | Buffer \| String | | Buffer containing image data, String containing the path to an image file, or Create object (see below) |
+| [images[].input.create] | Object | | describes a blank overlay to be created. |
+| [images[].input.create.width] | Number | | |
+| [images[].input.create.height] | Number | | |
+| [images[].input.create.channels] | Number | | 3-4 |
+| [images[].input.create.background] | String \| Object | | parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
+| [images[].input.text] | Object | | describes a new text image to be created. |
+| [images[].input.text.text] | string | | text to render as a UTF-8 string. It can contain Pango markup, for example `LeMonde`. |
+| [images[].input.text.font] | string | | font name to render with. |
+| [images[].input.text.fontfile] | string | | absolute filesystem path to a font file that can be used by `font`. |
+| [images[].input.text.width] | number | 0 | integral number of pixels to word-wrap at. Lines of text wider than this will be broken at word boundaries. |
+| [images[].input.text.height] | number | 0 | integral number of pixels high. When defined, `dpi` will be ignored and the text will automatically fit the pixel resolution defined by `width` and `height`. Will be ignored if `width` is not specified or set to 0. |
+| [images[].input.text.align] | string | "'left'" | text alignment (`'left'`, `'centre'`, `'center'`, `'right'`). |
+| [images[].input.text.justify] | boolean | false | set this to true to apply justification to the text. |
+| [images[].input.text.dpi] | number | 72 | the resolution (size) at which to render the text. Does not take effect if `height` is specified. |
+| [images[].input.text.rgba] | boolean | false | set this to true to enable RGBA output. This is useful for colour emoji rendering, or support for Pango markup features like `Red!`. |
+| [images[].input.text.spacing] | number | 0 | text line height in points. Will use the font line height if none is specified. |
+| [images[].autoOrient] | Boolean | false | set to true to use EXIF orientation data, if present, to orient the image. |
+| [images[].blend] | String | 'over' | how to blend this image with the image below. |
+| [images[].gravity] | String | 'centre' | gravity at which to place the overlay. |
+| [images[].top] | Number | | the pixel offset from the top edge. |
+| [images[].left] | Number | | the pixel offset from the left edge. |
+| [images[].tile] | Boolean | false | set to true to repeat the overlay image across the entire image with the given `gravity`. |
+| [images[].premultiplied] | Boolean | false | set to true to avoid premultiplying the image below. Equivalent to the `--premultiplied` vips option. |
+| [images[].density] | Number | 72 | number representing the DPI for vector overlay image. |
+| [images[].raw] | Object | | describes overlay when using raw pixel data. |
+| [images[].raw.width] | Number | | |
+| [images[].raw.height] | Number | | |
+| [images[].raw.channels] | Number | | |
+| [images[].animated] | boolean | false | Set to `true` to read all frames/pages of an animated image. |
+| [images[].failOn] | string | "'warning'" | @see [constructor parameters](/api-constructor/) |
+| [images[].limitInputPixels] | number \| boolean | 268402689 | @see [constructor parameters](/api-constructor/) |
+
+**Example**
+```js
+await sharp(background)
+ .composite([
+ { input: layer1, gravity: 'northwest' },
+ { input: layer2, gravity: 'southeast' },
+ ])
+ .toFile('combined.png');
+```
+**Example**
+```js
+const output = await sharp('input.gif', { animated: true })
+ .composite([
+ { input: 'overlay.png', tile: true, blend: 'saturate' }
+ ])
+ .toBuffer();
+```
+**Example**
+```js
+sharp('input.png')
+ .rotate(180)
+ .resize(300)
+ .flatten( { background: '#ff6600' } )
+ .composite([{ input: 'overlay.png', gravity: 'southeast' }])
+ .sharpen()
+ .withMetadata()
+ .webp( { quality: 90 } )
+ .toBuffer()
+ .then(function(outputBuffer) {
+ // outputBuffer contains upside down, 300px wide, alpha channel flattened
+ // onto orange background, composited with overlay.png with SE gravity,
+ // sharpened, with metadata, 90% quality WebP image data. Phew!
+ });
+```
\ No newline at end of file
diff --git a/docs/src/content/docs/api-constructor.md b/docs/src/content/docs/api-constructor.md
new file mode 100644
index 000000000..3504239dc
--- /dev/null
+++ b/docs/src/content/docs/api-constructor.md
@@ -0,0 +1,274 @@
+---
+# This file was auto-generated from JSDoc in lib/constructor.js
+title: Constructor
+---
+
+## Sharp
+> Sharp
+
+
+**Emits**: Sharp#event:info, Sharp#event:warning
+
+
+### new
+> new Sharp([input], [options])
+
+Constructor factory to create an instance of `sharp`, to which further methods are chained.
+
+JPEG, PNG, WebP, GIF, AVIF or TIFF format image data can be streamed out from this object.
+When using Stream based output, derived attributes are available from the `info` event.
+
+Non-critical problems encountered during processing are emitted as `warning` events.
+
+Implements the [stream.Duplex](http://nodejs.org/api/stream.html#stream_class_stream_duplex) class.
+
+When loading more than one page/frame of an animated image,
+these are combined as a vertically-stacked "toilet roll" image
+where the overall height is the `pageHeight` multiplied by the number of `pages`.
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [input] | Buffer \| ArrayBuffer \| Uint8Array \| Uint8ClampedArray \| Int8Array \| Uint16Array \| Int16Array \| Uint32Array \| Int32Array \| Float32Array \| Float64Array \| string \| Array | | if present, can be a Buffer / ArrayBuffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image data, or a TypedArray containing raw pixel image data, or a String containing the filesystem path to an JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image file. An array of inputs can be provided, and these will be joined together. JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present. |
+| [options] | Object | | if present, is an Object with optional attributes. |
+| [options.failOn] | string | "'warning'" | When to abort processing of invalid pixel data, one of (in order of sensitivity, least to most): 'none', 'truncated', 'error', 'warning'. Higher levels imply lower levels. Invalid metadata will always abort. |
+| [options.limitInputPixels] | number \| boolean | 268402689 | Do not process input images where the number of pixels (width x height) exceeds this limit. Assumes image dimensions contained in the input metadata can be trusted. An integral Number of pixels, zero or false to remove limit, true to use default limit of 268402689 (0x3FFF x 0x3FFF). |
+| [options.unlimited] | boolean | false | Set this to `true` to remove safety features that help prevent memory exhaustion (JPEG, PNG, SVG, HEIF). |
+| [options.autoOrient] | boolean | false | Set this to `true` to rotate/flip the image to match EXIF `Orientation`, if any. |
+| [options.sequentialRead] | boolean | true | Set this to `false` to use random access rather than sequential read. Some operations will do this automatically. |
+| [options.density] | number | 72 | number representing the DPI for vector images in the range 1 to 100000. |
+| [options.ignoreIcc] | number | false | should the embedded ICC profile, if any, be ignored. |
+| [options.pages] | number | 1 | Number of pages to extract for multi-page input (GIF, WebP, TIFF), use -1 for all pages. |
+| [options.page] | number | 0 | Page number to start extracting from for multi-page input (GIF, WebP, TIFF), zero based. |
+| [options.animated] | boolean | false | Set to `true` to read all frames/pages of an animated image (GIF, WebP, TIFF), equivalent of setting `pages` to `-1`. |
+| [options.raw] | Object | | describes raw pixel input image data. See `raw()` for pixel ordering. |
+| [options.raw.width] | number | | integral number of pixels wide. |
+| [options.raw.height] | number | | integral number of pixels high. |
+| [options.raw.channels] | number | | integral number of channels, between 1 and 4. |
+| [options.raw.premultiplied] | boolean | | specifies that the raw input has already been premultiplied, set to `true` to avoid sharp premultiplying the image. (optional, default `false`) |
+| [options.raw.pageHeight] | number | | The pixel height of each page/frame for animated images, must be an integral factor of `raw.height`. |
+| [options.create] | Object | | describes a new image to be created. |
+| [options.create.width] | number | | integral number of pixels wide. |
+| [options.create.height] | number | | integral number of pixels high. |
+| [options.create.channels] | number | | integral number of channels, either 3 (RGB) or 4 (RGBA). |
+| [options.create.background] | string \| Object | | parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
+| [options.create.pageHeight] | number | | The pixel height of each page/frame for animated images, must be an integral factor of `create.height`. |
+| [options.create.noise] | Object | | describes a noise to be created. |
+| [options.create.noise.type] | string | | type of generated noise, currently only `gaussian` is supported. |
+| [options.create.noise.mean] | number | 128 | Mean value of pixels in the generated noise. |
+| [options.create.noise.sigma] | number | 30 | Standard deviation of pixel values in the generated noise. |
+| [options.text] | Object | | describes a new text image to be created. |
+| [options.text.text] | string | | text to render as a UTF-8 string. It can contain Pango markup, for example `LeMonde`. |
+| [options.text.font] | string | | font name to render with. |
+| [options.text.fontfile] | string | | absolute filesystem path to a font file that can be used by `font`. |
+| [options.text.width] | number | 0 | Integral number of pixels to word-wrap at. Lines of text wider than this will be broken at word boundaries. |
+| [options.text.height] | number | 0 | Maximum integral number of pixels high. When defined, `dpi` will be ignored and the text will automatically fit the pixel resolution defined by `width` and `height`. Will be ignored if `width` is not specified or set to 0. |
+| [options.text.align] | string | "'left'" | Alignment style for multi-line text (`'left'`, `'centre'`, `'center'`, `'right'`). |
+| [options.text.justify] | boolean | false | set this to true to apply justification to the text. |
+| [options.text.dpi] | number | 72 | the resolution (size) at which to render the text. Does not take effect if `height` is specified. |
+| [options.text.rgba] | boolean | false | set this to true to enable RGBA output. This is useful for colour emoji rendering, or support for pango markup features like `Red!`. |
+| [options.text.spacing] | number | 0 | text line height in points. Will use the font line height if none is specified. |
+| [options.text.wrap] | string | "'word'" | word wrapping style when width is provided, one of: 'word', 'char', 'word-char' (prefer word, fallback to char) or 'none'. |
+| [options.join] | Object | | describes how an array of input images should be joined. |
+| [options.join.across] | number | 1 | number of images to join horizontally. |
+| [options.join.animated] | boolean | false | set this to `true` to join the images as an animated image. |
+| [options.join.shim] | number | 0 | number of pixels to insert between joined images. |
+| [options.join.background] | string \| Object | | parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
+| [options.join.halign] | string | "'left'" | horizontal alignment style for images joined horizontally (`'left'`, `'centre'`, `'center'`, `'right'`). |
+| [options.join.valign] | string | "'top'" | vertical alignment style for images joined vertically (`'top'`, `'centre'`, `'center'`, `'bottom'`). |
+| [options.tiff] | Object | | Describes TIFF specific options. |
+| [options.tiff.subifd] | number | -1 | Sub Image File Directory to extract for OME-TIFF, defaults to main image. |
+| [options.svg] | Object | | Describes SVG specific options. |
+| [options.svg.stylesheet] | string | | Custom CSS for SVG input, applied with a User Origin during the CSS cascade. |
+| [options.svg.highBitdepth] | boolean | false | Set to `true` to render SVG input at 32-bits per channel (128-bit) instead of 8-bits per channel (32-bit) RGBA. |
+| [options.pdf] | Object | | Describes PDF specific options. Requires the use of a globally-installed libvips compiled with support for PDFium, Poppler, ImageMagick or GraphicsMagick. |
+| [options.pdf.background] | string \| Object | | Background colour to use when PDF is partially transparent. Parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
+| [options.openSlide] | Object | | Describes OpenSlide specific options. Requires the use of a globally-installed libvips compiled with support for OpenSlide. |
+| [options.openSlide.level] | number | 0 | Level to extract from a multi-level input, zero based. |
+| [options.jp2] | Object | | Describes JPEG 2000 specific options. Requires the use of a globally-installed libvips compiled with support for OpenJPEG. |
+| [options.jp2.oneshot] | boolean | false | Set to `true` to decode tiled JPEG 2000 images in a single operation, improving compatibility. |
+
+**Example**
+```js
+sharp('input.jpg')
+ .resize(300, 200)
+ .toFile('output.jpg', function(err) {
+ // output.jpg is a 300 pixels wide and 200 pixels high image
+ // containing a scaled and cropped version of input.jpg
+ });
+```
+**Example**
+```js
+// Read image data from remote URL,
+// resize to 300 pixels wide,
+// emit an 'info' event with calculated dimensions
+// and finally write image data to writableStream
+const { body } = fetch('https://...');
+const readableStream = Readable.fromWeb(body);
+const transformer = sharp()
+ .resize(300)
+ .on('info', ({ height }) => {
+ console.log(`Image height is ${height}`);
+ });
+readableStream.pipe(transformer).pipe(writableStream);
+```
+**Example**
+```js
+// Create a blank 300x200 PNG image of semi-translucent red pixels
+sharp({
+ create: {
+ width: 300,
+ height: 200,
+ channels: 4,
+ background: { r: 255, g: 0, b: 0, alpha: 0.5 }
+ }
+})
+.png()
+.toBuffer()
+.then( ... );
+```
+**Example**
+```js
+// Convert an animated GIF to an animated WebP
+await sharp('in.gif', { animated: true }).toFile('out.webp');
+```
+**Example**
+```js
+// Read a raw array of pixels and save it to a png
+const input = Uint8Array.from([255, 255, 255, 0, 0, 0]); // or Uint8ClampedArray
+const image = sharp(input, {
+ // because the input does not contain its dimensions or how many channels it has
+ // we need to specify it in the constructor options
+ raw: {
+ width: 2,
+ height: 1,
+ channels: 3
+ }
+});
+await image.toFile('my-two-pixels.png');
+```
+**Example**
+```js
+// Generate RGB Gaussian noise
+await sharp({
+ create: {
+ width: 300,
+ height: 200,
+ channels: 3,
+ noise: {
+ type: 'gaussian',
+ mean: 128,
+ sigma: 30
+ }
+ }
+}).toFile('noise.png');
+```
+**Example**
+```js
+// Generate an image from text
+await sharp({
+ text: {
+ text: 'Hello, world!',
+ width: 400, // max width
+ height: 300 // max height
+ }
+}).toFile('text_bw.png');
+```
+**Example**
+```js
+// Generate an rgba image from text using pango markup and font
+await sharp({
+ text: {
+ text: 'Red!blue',
+ font: 'sans',
+ rgba: true,
+ dpi: 300
+ }
+}).toFile('text_rgba.png');
+```
+**Example**
+```js
+// Join four input images as a 2x2 grid with a 4 pixel gutter
+const data = await sharp(
+ [image1, image2, image3, image4],
+ { join: { across: 2, shim: 4 } }
+).toBuffer();
+```
+**Example**
+```js
+// Generate a two-frame animated image from emoji
+const images = ['😀', '😛'].map(text => ({
+ text: { text, width: 64, height: 64, channels: 4, rgba: true }
+}));
+await sharp(images, { join: { animated: true } }).toFile('out.gif');
+```
+
+
+## clone
+> clone() ⇒ [Sharp](#Sharp)
+
+Take a "snapshot" of the Sharp instance, returning a new instance.
+Cloned instances inherit the input of their parent instance.
+This allows multiple output Streams and therefore multiple processing pipelines to share a single input Stream.
+
+
+**Example**
+```js
+const pipeline = sharp().rotate();
+pipeline.clone().resize(800, 600).pipe(firstWritableStream);
+pipeline.clone().extract({ left: 20, top: 20, width: 100, height: 100 }).pipe(secondWritableStream);
+readableStream.pipe(pipeline);
+// firstWritableStream receives auto-rotated, resized readableStream
+// secondWritableStream receives auto-rotated, extracted region of readableStream
+```
+**Example**
+```js
+// Create a pipeline that will download an image, resize it and format it to different files
+// Using Promises to know when the pipeline is complete
+const fs = require("fs");
+const got = require("got");
+const sharpStream = sharp({ failOn: 'none' });
+
+const promises = [];
+
+promises.push(
+ sharpStream
+ .clone()
+ .jpeg({ quality: 100 })
+ .toFile("originalFile.jpg")
+);
+
+promises.push(
+ sharpStream
+ .clone()
+ .resize({ width: 500 })
+ .jpeg({ quality: 80 })
+ .toFile("optimized-500.jpg")
+);
+
+promises.push(
+ sharpStream
+ .clone()
+ .resize({ width: 500 })
+ .webp({ quality: 80 })
+ .toFile("optimized-500.webp")
+);
+
+// https://github.com/sindresorhus/got/blob/main/documentation/3-streams.md
+got.stream("https://www.example.com/some-file.jpg").pipe(sharpStream);
+
+Promise.all(promises)
+ .then(res => { console.log("Done!", res); })
+ .catch(err => {
+ console.error("Error processing files, let's clean it up", err);
+ try {
+ fs.unlinkSync("originalFile.jpg");
+ fs.unlinkSync("optimized-500.jpg");
+ fs.unlinkSync("optimized-500.webp");
+ } catch (e) {}
+ });
+```
\ No newline at end of file
diff --git a/docs/src/content/docs/api-input.md b/docs/src/content/docs/api-input.md
new file mode 100644
index 000000000..8477f1ff5
--- /dev/null
+++ b/docs/src/content/docs/api-input.md
@@ -0,0 +1,139 @@
+---
+# This file was auto-generated from JSDoc in lib/input.js
+title: Input metadata
+---
+
+## metadata
+> metadata([callback]) ⇒ Promise.<Object> \| Sharp
+
+Fast access to (uncached) image metadata without decoding any compressed pixel data.
+
+This is read from the header of the input image.
+It does not take into consideration any operations to be applied to the output image,
+such as resize or rotate.
+
+Dimensions in the response will respect the `page` and `pages` properties of the
+[constructor parameters](/api-constructor/).
+
+A `Promise` is returned when `callback` is not provided.
+
+- `format`: Name of decoder used to parse image e.g. `jpeg`, `png`, `webp`, `gif`, `svg`, `heif`, `tiff`
+- `size`: Total size of image in bytes, for Stream and Buffer input only
+- `width`: Number of pixels wide (EXIF orientation is not taken into consideration, see example below)
+- `height`: Number of pixels high (EXIF orientation is not taken into consideration, see example below)
+- `space`: Name of colour space interpretation e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://www.libvips.org/API/current/enum.Interpretation.html)
+- `channels`: Number of bands e.g. `3` for sRGB, `4` for CMYK
+- `depth`: Name of pixel depth format e.g. `uchar`, `char`, `ushort`, `float` [...](https://www.libvips.org/API/current/enum.BandFormat.html)
+- `density`: Number of pixels per inch (DPI), if present
+- `chromaSubsampling`: String containing JPEG chroma subsampling, `4:2:0` or `4:4:4` for RGB, `4:2:0:4` or `4:4:4:4` for CMYK
+- `isProgressive`: Boolean indicating whether the image is interlaced using a progressive scan
+- `isPalette`: Boolean indicating whether the image is palette-based (GIF, PNG).
+- `bitsPerSample`: Number of bits per sample for each channel (GIF, PNG, HEIF).
+- `pages`: Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP
+- `pageHeight`: Number of pixels high each page in a multi-page image will be.
+- `loop`: Number of times to loop an animated image, zero refers to a continuous loop.
+- `delay`: Delay in ms between each page in an animated image, provided as an array of integers.
+- `pagePrimary`: Number of the primary page in a HEIF image
+- `levels`: Details of each level in a multi-level image provided as an array of objects, requires libvips compiled with support for OpenSlide
+- `subifds`: Number of Sub Image File Directories in an OME-TIFF image
+- `background`: Default background colour, if present, for PNG (bKGD) and GIF images
+- `compression`: The encoder used to compress an HEIF file, `av1` (AVIF) or `hevc` (HEIC)
+- `resolutionUnit`: The unit of resolution (density), either `inch` or `cm`, if present
+- `hasProfile`: Boolean indicating the presence of an embedded ICC profile
+- `hasAlpha`: Boolean indicating the presence of an alpha transparency channel
+- `orientation`: Number value of the EXIF Orientation header, if present
+- `exif`: Buffer containing raw EXIF data, if present
+- `icc`: Buffer containing raw [ICC](https://www.npmjs.com/package/icc) profile data, if present
+- `iptc`: Buffer containing raw IPTC data, if present
+- `xmp`: Buffer containing raw XMP data, if present
+- `xmpAsString`: String containing XMP data, if valid UTF-8.
+- `tifftagPhotoshop`: Buffer containing raw TIFFTAG_PHOTOSHOP data, if present
+- `formatMagick`: String containing format for images loaded via *magick
+- `comments`: Array of keyword/text pairs representing PNG text blocks, if present.
+
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [callback] | function | called with the arguments `(err, metadata)` |
+
+**Example**
+```js
+const metadata = await sharp(input).metadata();
+```
+**Example**
+```js
+const image = sharp(inputJpg);
+image
+ .metadata()
+ .then(function(metadata) {
+ return image
+ .resize(Math.round(metadata.width / 2))
+ .webp()
+ .toBuffer();
+ })
+ .then(function(data) {
+ // data contains a WebP image half the width and height of the original JPEG
+ });
+```
+**Example**
+```js
+// Get dimensions taking EXIF Orientation into account.
+const { autoOrient } = await sharp(input).metadata();
+const { width, height } = autoOrient;
+```
+
+
+## stats
+> stats([callback]) ⇒ Promise.<Object>
+
+Access to pixel-derived image statistics for every channel in the image.
+A `Promise` is returned when `callback` is not provided.
+
+- `channels`: Array of channel statistics for each channel in the image. Each channel statistic contains
+ - `min` (minimum value in the channel)
+ - `max` (maximum value in the channel)
+ - `sum` (sum of all values in a channel)
+ - `squaresSum` (sum of squared values in a channel)
+ - `mean` (mean of the values in a channel)
+ - `stdev` (standard deviation for the values in a channel)
+ - `minX` (x-coordinate of one of the pixel where the minimum lies)
+ - `minY` (y-coordinate of one of the pixel where the minimum lies)
+ - `maxX` (x-coordinate of one of the pixel where the maximum lies)
+ - `maxY` (y-coordinate of one of the pixel where the maximum lies)
+- `isOpaque`: Is the image fully opaque? Will be `true` if the image has no alpha channel or if every pixel is fully opaque.
+- `entropy`: Histogram-based estimation of greyscale entropy, discarding alpha channel if any.
+- `sharpness`: Estimation of greyscale sharpness based on the standard deviation of a Laplacian convolution, discarding alpha channel if any.
+- `dominant`: Object containing most dominant sRGB colour based on a 4096-bin 3D histogram.
+
+**Note**: Statistics are derived from the original input image. Any operations performed on the image must first be
+written to a buffer in order to run `stats` on the result (see third example).
+
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [callback] | function | called with the arguments `(err, stats)` |
+
+**Example**
+```js
+const image = sharp(inputJpg);
+image
+ .stats()
+ .then(function(stats) {
+ // stats contains the channel-wise statistics array and the isOpaque value
+ });
+```
+**Example**
+```js
+const { entropy, sharpness, dominant } = await sharp(input).stats();
+const { r, g, b } = dominant;
+```
+**Example**
+```js
+const image = sharp(input);
+// store intermediate result
+const part = await image.extract(region).toBuffer();
+// create new instance to obtain statistics of extracted region
+const stats = await sharp(part).stats();
+```
\ No newline at end of file
diff --git a/docs/src/content/docs/api-operation.md b/docs/src/content/docs/api-operation.md
new file mode 100644
index 000000000..abcb41fc1
--- /dev/null
+++ b/docs/src/content/docs/api-operation.md
@@ -0,0 +1,723 @@
+---
+# This file was auto-generated from JSDoc in lib/operation.js
+title: Image operations
+---
+
+## rotate
+> rotate([angle], [options]) ⇒ Sharp
+
+Rotate the output image.
+
+The provided angle is converted to a valid positive degree rotation.
+For example, `-450` will produce a 270 degree rotation.
+
+When rotating by an angle other than a multiple of 90,
+the background colour can be provided with the `background` option.
+
+For backwards compatibility, if no angle is provided, `.autoOrient()` will be called.
+
+Only one rotation can occur per pipeline (aside from an initial call without
+arguments to orient via EXIF data). Previous calls to `rotate` in the same
+pipeline will be ignored.
+
+Multi-page images can only be rotated by 180 degrees.
+
+Method order is important when rotating, resizing and/or extracting regions,
+for example `.rotate(x).extract(y)` will produce a different result to `.extract(y).rotate(x)`.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [angle] | number | auto | angle of rotation. |
+| [options] | Object | | if present, is an Object with optional attributes. |
+| [options.background] | string \| Object | "\"#000000\"" | parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
+
+**Example**
+```js
+const rotateThenResize = await sharp(input)
+ .rotate(90)
+ .resize({ width: 16, height: 8, fit: 'fill' })
+ .toBuffer();
+const resizeThenRotate = await sharp(input)
+ .resize({ width: 16, height: 8, fit: 'fill' })
+ .rotate(90)
+ .toBuffer();
+```
+
+
+## autoOrient
+> autoOrient() ⇒ Sharp
+
+Auto-orient based on the EXIF `Orientation` tag, then remove the tag.
+Mirroring is supported and may infer the use of a flip operation.
+
+Previous or subsequent use of `rotate(angle)` and either `flip()` or `flop()`
+will logically occur after auto-orientation, regardless of call order.
+
+
+**Example**
+```js
+const output = await sharp(input).autoOrient().toBuffer();
+```
+**Example**
+```js
+const pipeline = sharp()
+ .autoOrient()
+ .resize(null, 200)
+ .toBuffer(function (err, outputBuffer, info) {
+ // outputBuffer contains 200px high JPEG image data,
+ // auto-oriented using EXIF Orientation tag
+ // info.width and info.height contain the dimensions of the resized image
+ });
+readableStream.pipe(pipeline);
+```
+
+
+## flip
+> flip([flip]) ⇒ Sharp
+
+Mirror the image vertically (up-down) about the x-axis.
+This always occurs before rotation, if any.
+
+This operation does not work correctly with multi-page images.
+
+
+
+| Param | Type | Default |
+| --- | --- | --- |
+| [flip] | Boolean | true |
+
+**Example**
+```js
+const output = await sharp(input).flip().toBuffer();
+```
+
+
+## flop
+> flop([flop]) ⇒ Sharp
+
+Mirror the image horizontally (left-right) about the y-axis.
+This always occurs before rotation, if any.
+
+
+
+| Param | Type | Default |
+| --- | --- | --- |
+| [flop] | Boolean | true |
+
+**Example**
+```js
+const output = await sharp(input).flop().toBuffer();
+```
+
+
+## affine
+> affine(matrix, [options]) ⇒ Sharp
+
+Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
+
+You must provide an array of length 4 or a 2x2 affine transformation matrix.
+By default, new pixels are filled with a black background. You can provide a background colour with the `background` option.
+A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
+
+In the case of a 2x2 matrix, the transform is:
+- X = `matrix[0, 0]` \* (x + `idx`) + `matrix[0, 1]` \* (y + `idy`) + `odx`
+- Y = `matrix[1, 0]` \* (x + `idx`) + `matrix[1, 1]` \* (y + `idy`) + `ody`
+
+where:
+- x and y are the coordinates in input image.
+- X and Y are the coordinates in output image.
+- (0,0) is the upper left corner.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+**Since**: 0.27.0
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| matrix | Array.<Array.<number>> \| Array.<number> | | affine transformation matrix |
+| [options] | Object | | if present, is an Object with optional attributes. |
+| [options.background] | String \| Object | "#000000" | parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
+| [options.idx] | Number | 0 | input horizontal offset |
+| [options.idy] | Number | 0 | input vertical offset |
+| [options.odx] | Number | 0 | output horizontal offset |
+| [options.ody] | Number | 0 | output vertical offset |
+| [options.interpolator] | String | sharp.interpolators.bicubic | interpolator |
+
+**Example**
+```js
+const pipeline = sharp()
+ .affine([[1, 0.3], [0.1, 0.7]], {
+ background: 'white',
+ interpolator: sharp.interpolators.nohalo
+ })
+ .toBuffer((err, outputBuffer, info) => {
+ // outputBuffer contains the transformed image
+ // info.width and info.height contain the new dimensions
+ });
+
+inputStream
+ .pipe(pipeline);
+```
+
+
+## sharpen
+> sharpen([options], [flat], [jagged]) ⇒ Sharp
+
+Sharpen the image.
+
+When used without parameters, performs a fast, mild sharpen of the output image.
+
+When a `sigma` is provided, performs a slower, more accurate sharpen of the L channel in the LAB colour space.
+Fine-grained control over the level of sharpening in "flat" (m1) and "jagged" (m2) areas is available.
+
+See [libvips sharpen](https://www.libvips.org/API/current/method.Image.sharpen.html) operation.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object \| number | | if present, is an Object with attributes |
+| [options.sigma] | number | | the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`, between 0.000001 and 10 |
+| [options.m1] | number | 1.0 | the level of sharpening to apply to "flat" areas, between 0 and 1000000 |
+| [options.m2] | number | 2.0 | the level of sharpening to apply to "jagged" areas, between 0 and 1000000 |
+| [options.x1] | number | 2.0 | threshold between "flat" and "jagged", between 0 and 1000000 |
+| [options.y2] | number | 10.0 | maximum amount of brightening, between 0 and 1000000 |
+| [options.y3] | number | 20.0 | maximum amount of darkening, between 0 and 1000000 |
+| [flat] | number | | (deprecated) see `options.m1`. |
+| [jagged] | number | | (deprecated) see `options.m2`. |
+
+**Example**
+```js
+const data = await sharp(input).sharpen().toBuffer();
+```
+**Example**
+```js
+const data = await sharp(input).sharpen({ sigma: 2 }).toBuffer();
+```
+**Example**
+```js
+const data = await sharp(input)
+ .sharpen({
+ sigma: 2,
+ m1: 0,
+ m2: 3,
+ x1: 3,
+ y2: 15,
+ y3: 15,
+ })
+ .toBuffer();
+```
+
+
+## median
+> median([size]) ⇒ Sharp
+
+Apply median filter.
+When used without parameters the default window is 3x3.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [size] | number | 3 | square mask size: size x size |
+
+**Example**
+```js
+const output = await sharp(input).median().toBuffer();
+```
+**Example**
+```js
+const output = await sharp(input).median(5).toBuffer();
+```
+
+
+## blur
+> blur([options]) ⇒ Sharp
+
+Blur the image.
+
+When used without parameters, performs a fast 3x3 box blur (equivalent to a box linear filter).
+
+When a `sigma` is provided, performs a slower, more accurate Gaussian blur.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object \| number \| Boolean | | |
+| [options.sigma] | number | | a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`. |
+| [options.precision] | string | "'integer'" | How accurate the operation should be, one of: integer, float, approximate. |
+| [options.minAmplitude] | number | 0.2 | A value between 0.001 and 1. A smaller value will generate a larger, more accurate mask. |
+
+**Example**
+```js
+const boxBlurred = await sharp(input)
+ .blur()
+ .toBuffer();
+```
+**Example**
+```js
+const gaussianBlurred = await sharp(input)
+ .blur(5)
+ .toBuffer();
+```
+
+
+## dilate
+> dilate([width]) ⇒ Sharp
+
+Expand foreground objects using the dilate morphological operator.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [width] | Number | 1 | dilation width in pixels. |
+
+**Example**
+```js
+const output = await sharp(input)
+ .dilate()
+ .toBuffer();
+```
+
+
+## erode
+> erode([width]) ⇒ Sharp
+
+Shrink foreground objects using the erode morphological operator.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [width] | Number | 1 | erosion width in pixels. |
+
+**Example**
+```js
+const output = await sharp(input)
+ .erode()
+ .toBuffer();
+```
+
+
+## flatten
+> flatten([options]) ⇒ Sharp
+
+Merge alpha transparency channel, if any, with a background, then remove the alpha channel.
+
+See also [removeAlpha](/api-channel#removealpha).
+
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | |
+| [options.background] | string \| Object | "{r: 0, g: 0, b: 0}" | background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black. |
+
+**Example**
+```js
+await sharp(rgbaInput)
+ .flatten({ background: '#F0A703' })
+ .toBuffer();
+```
+
+
+## unflatten
+> unflatten()
+
+Ensure the image has an alpha channel
+with all white pixel values made fully transparent.
+
+Existing alpha channel values for non-white pixels remain unchanged.
+
+This feature is experimental and the API may change.
+
+
+**Since**: 0.32.1
+**Example**
+```js
+await sharp(rgbInput)
+ .unflatten()
+ .toBuffer();
+```
+**Example**
+```js
+await sharp(rgbInput)
+ .threshold(128, { grayscale: false }) // converter bright pixels to white
+ .unflatten()
+ .toBuffer();
+```
+
+
+## gamma
+> gamma([gamma], [gammaOut]) ⇒ Sharp
+
+Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of `1/gamma`
+then increasing the encoding (brighten) post-resize at a factor of `gamma`.
+This can improve the perceived brightness of a resized image in non-linear colour spaces.
+JPEG and WebP input images will not take advantage of the shrink-on-load performance optimisation
+when applying a gamma correction.
+
+Supply a second argument to use a different output gamma value, otherwise the first value is used in both cases.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [gamma] | number | 2.2 | value between 1.0 and 3.0. |
+| [gammaOut] | number | | value between 1.0 and 3.0. (optional, defaults to same as `gamma`) |
+
+
+
+## negate
+> negate([options]) ⇒ Sharp
+
+Produce the "negative" of the image.
+
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | |
+| [options.alpha] | Boolean | true | Whether or not to negate any alpha channel |
+
+**Example**
+```js
+const output = await sharp(input)
+ .negate()
+ .toBuffer();
+```
+**Example**
+```js
+const output = await sharp(input)
+ .negate({ alpha: false })
+ .toBuffer();
+```
+
+
+## normalise
+> normalise([options]) ⇒ Sharp
+
+Enhance output image contrast by stretching its luminance to cover a full dynamic range.
+
+Uses a histogram-based approach, taking a default range of 1% to 99% to reduce sensitivity to noise at the extremes.
+
+Luminance values below the `lower` percentile will be underexposed by clipping to zero.
+Luminance values above the `upper` percentile will be overexposed by clipping to the max pixel value.
+
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | |
+| [options.lower] | number | 1 | Percentile below which luminance values will be underexposed. |
+| [options.upper] | number | 99 | Percentile above which luminance values will be overexposed. |
+
+**Example**
+```js
+const output = await sharp(input)
+ .normalise()
+ .toBuffer();
+```
+**Example**
+```js
+const output = await sharp(input)
+ .normalise({ lower: 0, upper: 100 })
+ .toBuffer();
+```
+
+
+## normalize
+> normalize([options]) ⇒ Sharp
+
+Alternative spelling of normalise.
+
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | |
+| [options.lower] | number | 1 | Percentile below which luminance values will be underexposed. |
+| [options.upper] | number | 99 | Percentile above which luminance values will be overexposed. |
+
+**Example**
+```js
+const output = await sharp(input)
+ .normalize()
+ .toBuffer();
+```
+
+
+## clahe
+> clahe(options) ⇒ Sharp
+
+Perform contrast limiting adaptive histogram equalization
+[CLAHE](https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE).
+
+This will, in general, enhance the clarity of the image by bringing out darker details.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+**Since**: 0.28.3
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| options | Object | | |
+| options.width | number | | Integral width of the search window, in pixels. |
+| options.height | number | | Integral height of the search window, in pixels. |
+| [options.maxSlope] | number | 3 | Integral level of brightening, between 0 and 100, where 0 disables contrast limiting. |
+
+**Example**
+```js
+const output = await sharp(input)
+ .clahe({
+ width: 3,
+ height: 3,
+ })
+ .toBuffer();
+```
+
+
+## convolve
+> convolve(kernel) ⇒ Sharp
+
+Convolve the image with the specified kernel.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| kernel | Object | | |
+| kernel.width | number | | width of the kernel in pixels. |
+| kernel.height | number | | height of the kernel in pixels. |
+| kernel.kernel | Array.<number> | | Array of length `width*height` containing the kernel values. |
+| [kernel.scale] | number | sum | the scale of the kernel in pixels. |
+| [kernel.offset] | number | 0 | the offset of the kernel in pixels. |
+
+**Example**
+```js
+sharp(input)
+ .convolve({
+ width: 3,
+ height: 3,
+ kernel: [-1, 0, 1, -2, 0, 2, -1, 0, 1]
+ })
+ .raw()
+ .toBuffer(function(err, data, info) {
+ // data contains the raw pixel data representing the convolution
+ // of the input image with the horizontal Sobel operator
+ });
+```
+
+
+## threshold
+> threshold([threshold], [options]) ⇒ Sharp
+
+Any pixel value greater than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [threshold] | number | 128 | a value in the range 0-255 representing the level at which the threshold will be applied. |
+| [options] | Object | | |
+| [options.greyscale] | Boolean | true | convert to single channel greyscale. |
+| [options.grayscale] | Boolean | true | alternative spelling for greyscale. |
+
+
+
+## boolean
+> boolean(operand, operator, [options]) ⇒ Sharp
+
+Perform a bitwise boolean operation with operand image.
+
+This operation creates an output image where each pixel is the result of
+the selected bitwise boolean `operation` between the corresponding pixels of the input images.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| operand | Buffer \| string | Buffer containing image data or string containing the path to an image file. |
+| operator | string | one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively. |
+| [options] | Object | |
+| [options.raw] | Object | describes operand when using raw pixel data. |
+| [options.raw.width] | number | |
+| [options.raw.height] | number | |
+| [options.raw.channels] | number | |
+
+
+
+## linear
+> linear([a], [b]) ⇒ Sharp
+
+Apply the linear formula `a` * input + `b` to the image to adjust image levels.
+
+When a single number is provided, it will be used for all image channels.
+When an array of numbers is provided, the array length must match the number of channels.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [a] | number \| Array.<number> | [] | multiplier |
+| [b] | number \| Array.<number> | [] | offset |
+
+**Example**
+```js
+await sharp(input)
+ .linear(0.5, 2)
+ .toBuffer();
+```
+**Example**
+```js
+await sharp(rgbInput)
+ .linear(
+ [0.25, 0.5, 0.75],
+ [150, 100, 50]
+ )
+ .toBuffer();
+```
+
+
+## recomb
+> recomb(inputMatrix) ⇒ Sharp
+
+Recombine the image with the specified matrix.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+**Since**: 0.21.1
+
+| Param | Type | Description |
+| --- | --- | --- |
+| inputMatrix | Array.<Array.<number>> | 3x3 or 4x4 Recombination matrix |
+
+**Example**
+```js
+sharp(input)
+ .recomb([
+ [0.3588, 0.7044, 0.1368],
+ [0.2990, 0.5870, 0.1140],
+ [0.2392, 0.4696, 0.0912],
+ ])
+ .raw()
+ .toBuffer(function(err, data, info) {
+ // data contains the raw pixel data after applying the matrix
+ // With this example input, a sepia filter has been applied
+ });
+```
+
+
+## modulate
+> modulate([options]) ⇒ Sharp
+
+Transforms the image using brightness, saturation, hue rotation, and lightness.
+Brightness and lightness both operate on luminance, with the difference being that
+brightness is multiplicative whereas lightness is additive.
+
+
+**Since**: 0.22.1
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [options] | Object | |
+| [options.brightness] | number | Brightness multiplier |
+| [options.saturation] | number | Saturation multiplier |
+| [options.hue] | number | Degrees for hue rotation |
+| [options.lightness] | number | Lightness addend |
+
+**Example**
+```js
+// increase brightness by a factor of 2
+const output = await sharp(input)
+ .modulate({
+ brightness: 2
+ })
+ .toBuffer();
+```
+**Example**
+```js
+// hue-rotate by 180 degrees
+const output = await sharp(input)
+ .modulate({
+ hue: 180
+ })
+ .toBuffer();
+```
+**Example**
+```js
+// increase lightness by +50
+const output = await sharp(input)
+ .modulate({
+ lightness: 50
+ })
+ .toBuffer();
+```
+**Example**
+```js
+// decrease brightness and saturation while also hue-rotating by 90 degrees
+const output = await sharp(input)
+ .modulate({
+ brightness: 0.5,
+ saturation: 0.5,
+ hue: 90,
+ })
+ .toBuffer();
+```
\ No newline at end of file
diff --git a/docs/src/content/docs/api-output.md b/docs/src/content/docs/api-output.md
new file mode 100644
index 000000000..5acd2fadb
--- /dev/null
+++ b/docs/src/content/docs/api-output.md
@@ -0,0 +1,911 @@
+---
+# This file was auto-generated from JSDoc in lib/output.js
+title: Output options
+---
+
+## toFile
+> toFile(fileOut, [callback]) ⇒ Promise.<Object>
+
+Write output image data to a file.
+
+If an explicit output format is not selected, it will be inferred from the extension,
+with JPEG, PNG, WebP, AVIF, TIFF, GIF, DZI, and libvips' V format supported.
+Note that raw pixel data is only supported for buffer output.
+
+By default all metadata will be removed, which includes EXIF-based orientation.
+See [withMetadata](#withmetadata) for control over this.
+
+The caller is responsible for ensuring directory structures and permissions exist.
+
+A `Promise` is returned when `callback` is not provided.
+
+
+**Returns**: Promise.<Object> - - when no callback is provided
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| fileOut | string | the path to write the image data to. |
+| [callback] | function | called on completion with two arguments `(err, info)`. `info` contains the output image `format`, `size` (bytes), `width`, `height`, `channels` and `premultiplied` (indicating if premultiplication was used). When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`. When using the attention crop strategy also contains `attentionX` and `attentionY`, the focal point of the cropped region. Animated output will also contain `pageHeight` and `pages`. May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text. |
+
+**Example**
+```js
+sharp(input)
+ .toFile('output.png', (err, info) => { ... });
+```
+**Example**
+```js
+sharp(input)
+ .toFile('output.png')
+ .then(info => { ... })
+ .catch(err => { ... });
+```
+
+
+## toBuffer
+> toBuffer([options], [callback]) ⇒ Promise.<Buffer>
+
+Write output to a Buffer.
+JPEG, PNG, WebP, AVIF, TIFF, GIF and raw pixel data output are supported.
+
+Use [toFormat](#toformat) or one of the format-specific functions such as [jpeg](#jpeg), [png](#png) etc. to set the output format.
+
+If no explicit format is set, the output format will match the input image, except SVG input which becomes PNG output.
+
+By default all metadata will be removed, which includes EXIF-based orientation.
+See [withMetadata](#withmetadata) for control over this.
+
+`callback`, if present, gets three arguments `(err, data, info)` where:
+- `err` is an error, if any.
+- `data` is the output image data.
+- `info` contains the output image `format`, `size` (bytes), `width`, `height`,
+`channels` and `premultiplied` (indicating if premultiplication was used).
+When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
+Animated output will also contain `pageHeight` and `pages`.
+May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
+
+A `Promise` is returned when `callback` is not provided.
+
+
+**Returns**: Promise.<Buffer> - - when no callback is provided
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [options] | Object | |
+| [options.resolveWithObject] | boolean | Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`. |
+| [callback] | function | |
+
+**Example**
+```js
+sharp(input)
+ .toBuffer((err, data, info) => { ... });
+```
+**Example**
+```js
+sharp(input)
+ .toBuffer()
+ .then(data => { ... })
+ .catch(err => { ... });
+```
+**Example**
+```js
+sharp(input)
+ .png()
+ .toBuffer({ resolveWithObject: true })
+ .then(({ data, info }) => { ... })
+ .catch(err => { ... });
+```
+**Example**
+```js
+const { data, info } = await sharp('my-image.jpg')
+ // output the raw pixels
+ .raw()
+ .toBuffer({ resolveWithObject: true });
+
+// create a more type safe way to work with the raw pixel data
+// this will not copy the data, instead it will change `data`s underlying ArrayBuffer
+// so `data` and `pixelArray` point to the same memory location
+const pixelArray = new Uint8ClampedArray(data.buffer);
+
+// When you are done changing the pixelArray, sharp takes the `pixelArray` as an input
+const { width, height, channels } = info;
+await sharp(pixelArray, { raw: { width, height, channels } })
+ .toFile('my-changed-image.jpg');
+```
+
+
+## keepExif
+> keepExif() ⇒ Sharp
+
+Keep all EXIF metadata from the input image in the output image.
+
+EXIF metadata is unsupported for TIFF output.
+
+
+**Since**: 0.33.0
+**Example**
+```js
+const outputWithExif = await sharp(inputWithExif)
+ .keepExif()
+ .toBuffer();
+```
+
+
+## withExif
+> withExif(exif) ⇒ Sharp
+
+Set EXIF metadata in the output image, ignoring any EXIF in the input image.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+**Since**: 0.33.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| exif | Object.<string, Object.<string, string>> | Object keyed by IFD0, IFD1 etc. of key/value string pairs to write as EXIF data. |
+
+**Example**
+```js
+const dataWithExif = await sharp(input)
+ .withExif({
+ IFD0: {
+ Copyright: 'The National Gallery'
+ },
+ IFD3: {
+ GPSLatitudeRef: 'N',
+ GPSLatitude: '51/1 30/1 3230/100',
+ GPSLongitudeRef: 'W',
+ GPSLongitude: '0/1 7/1 4366/100'
+ }
+ })
+ .toBuffer();
+```
+
+
+## withExifMerge
+> withExifMerge(exif) ⇒ Sharp
+
+Update EXIF metadata from the input image in the output image.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+**Since**: 0.33.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| exif | Object.<string, Object.<string, string>> | Object keyed by IFD0, IFD1 etc. of key/value string pairs to write as EXIF data. |
+
+**Example**
+```js
+const dataWithMergedExif = await sharp(inputWithExif)
+ .withExifMerge({
+ IFD0: {
+ Copyright: 'The National Gallery'
+ }
+ })
+ .toBuffer();
+```
+
+
+## keepIccProfile
+> keepIccProfile() ⇒ Sharp
+
+Keep ICC profile from the input image in the output image.
+
+When input and output colour spaces differ, use with [toColourspace](/api-colour/#tocolourspace) and optionally [pipelineColourspace](/api-colour/#pipelinecolourspace).
+
+
+**Since**: 0.33.0
+**Example**
+```js
+const outputWithIccProfile = await sharp(inputWithIccProfile)
+ .keepIccProfile()
+ .toBuffer();
+```
+**Example**
+```js
+const cmykOutputWithIccProfile = await sharp(cmykInputWithIccProfile)
+ .pipelineColourspace('cmyk')
+ .toColourspace('cmyk')
+ .keepIccProfile()
+ .toBuffer();
+```
+
+
+## withIccProfile
+> withIccProfile(icc, [options]) ⇒ Sharp
+
+Transform using an ICC profile and attach to the output image.
+
+This can either be an absolute filesystem path or
+built-in profile name (`srgb`, `p3`, `cmyk`).
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+**Since**: 0.33.0
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| icc | string | | Absolute filesystem path to output ICC profile or built-in profile name (srgb, p3, cmyk). |
+| [options] | Object | | |
+| [options.attach] | number | true | Should the ICC profile be included in the output image metadata? |
+
+**Example**
+```js
+const outputWithP3 = await sharp(input)
+ .withIccProfile('p3')
+ .toBuffer();
+```
+
+
+## keepXmp
+> keepXmp() ⇒ Sharp
+
+Keep XMP metadata from the input image in the output image.
+
+
+**Since**: 0.34.3
+**Example**
+```js
+const outputWithXmp = await sharp(inputWithXmp)
+ .keepXmp()
+ .toBuffer();
+```
+
+
+## withXmp
+> withXmp(xmp) ⇒ Sharp
+
+Set XMP metadata in the output image.
+
+Supported by PNG, JPEG, WebP, and TIFF output.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+**Since**: 0.34.3
+
+| Param | Type | Description |
+| --- | --- | --- |
+| xmp | string | String containing XMP metadata to be embedded in the output image. |
+
+**Example**
+```js
+const xmpString = `
+
+
+
+
+ John Doe
+
+
+ `;
+
+const data = await sharp(input)
+ .withXmp(xmpString)
+ .toBuffer();
+```
+
+
+## keepMetadata
+> keepMetadata() ⇒ Sharp
+
+Keep all metadata (EXIF, ICC, XMP, IPTC) from the input image in the output image.
+
+The default behaviour, when `keepMetadata` is not used, is to convert to the device-independent
+sRGB colour space and strip all metadata, including the removal of any ICC profile.
+
+
+**Since**: 0.33.0
+**Example**
+```js
+const outputWithMetadata = await sharp(inputWithMetadata)
+ .keepMetadata()
+ .toBuffer();
+```
+
+
+## withMetadata
+> withMetadata([options]) ⇒ Sharp
+
+Keep most metadata (EXIF, XMP, IPTC) from the input image in the output image.
+
+This will also convert to and add a web-friendly sRGB ICC profile if appropriate.
+
+Allows orientation and density to be set or updated.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [options] | Object | |
+| [options.orientation] | number | Used to update the EXIF `Orientation` tag, integer between 1 and 8. |
+| [options.density] | number | Number of pixels per inch (DPI). |
+
+**Example**
+```js
+const outputSrgbWithMetadata = await sharp(inputRgbWithMetadata)
+ .withMetadata()
+ .toBuffer();
+```
+**Example**
+```js
+// Set output metadata to 96 DPI
+const data = await sharp(input)
+ .withMetadata({ density: 96 })
+ .toBuffer();
+```
+
+
+## toFormat
+> toFormat(format, options) ⇒ Sharp
+
+Force output to a given format.
+
+
+**Throws**:
+
+- Error unsupported format or options
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| format | string \| Object | as a string or an Object with an 'id' attribute |
+| options | Object | output options |
+
+**Example**
+```js
+// Convert any input to PNG output
+const data = await sharp(input)
+ .toFormat('png')
+ .toBuffer();
+```
+
+
+## jpeg
+> jpeg([options]) ⇒ Sharp
+
+Use these JPEG options for output image.
+
+
+**Throws**:
+
+- Error Invalid options
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | output options |
+| [options.quality] | number | 80 | quality, integer 1-100 |
+| [options.progressive] | boolean | false | use progressive (interlace) scan |
+| [options.chromaSubsampling] | string | "'4:2:0'" | set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling |
+| [options.optimiseCoding] | boolean | true | optimise Huffman coding tables |
+| [options.optimizeCoding] | boolean | true | alternative spelling of optimiseCoding |
+| [options.mozjpeg] | boolean | false | use mozjpeg defaults, equivalent to `{ trellisQuantisation: true, overshootDeringing: true, optimiseScans: true, quantisationTable: 3 }` |
+| [options.trellisQuantisation] | boolean | false | apply trellis quantisation |
+| [options.overshootDeringing] | boolean | false | apply overshoot deringing |
+| [options.optimiseScans] | boolean | false | optimise progressive scans, forces progressive |
+| [options.optimizeScans] | boolean | false | alternative spelling of optimiseScans |
+| [options.quantisationTable] | number | 0 | quantization table to use, integer 0-8 |
+| [options.quantizationTable] | number | 0 | alternative spelling of quantisationTable |
+| [options.force] | boolean | true | force JPEG output, otherwise attempt to use input format |
+
+**Example**
+```js
+// Convert any input to very high quality JPEG output
+const data = await sharp(input)
+ .jpeg({
+ quality: 100,
+ chromaSubsampling: '4:4:4'
+ })
+ .toBuffer();
+```
+**Example**
+```js
+// Use mozjpeg to reduce output JPEG file size (slower)
+const data = await sharp(input)
+ .jpeg({ mozjpeg: true })
+ .toBuffer();
+```
+
+
+## png
+> png([options]) ⇒ Sharp
+
+Use these PNG options for output image.
+
+By default, PNG output is full colour at 8 bits per pixel.
+
+Indexed PNG input at 1, 2 or 4 bits per pixel is converted to 8 bits per pixel.
+Set `palette` to `true` for slower, indexed PNG output.
+
+For 16 bits per pixel output, convert to `rgb16` via
+[toColourspace](/api-colour/#tocolourspace).
+
+
+**Throws**:
+
+- Error Invalid options
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | |
+| [options.progressive] | boolean | false | use progressive (interlace) scan |
+| [options.compressionLevel] | number | 6 | zlib compression level, 0 (fastest, largest) to 9 (slowest, smallest) |
+| [options.adaptiveFiltering] | boolean | false | use adaptive row filtering |
+| [options.palette] | boolean | false | quantise to a palette-based image with alpha transparency support |
+| [options.quality] | number | 100 | use the lowest number of colours needed to achieve given quality, sets `palette` to `true` |
+| [options.effort] | number | 7 | CPU effort, between 1 (fastest) and 10 (slowest), sets `palette` to `true` |
+| [options.colours] | number | 256 | maximum number of palette entries, sets `palette` to `true` |
+| [options.colors] | number | 256 | alternative spelling of `options.colours`, sets `palette` to `true` |
+| [options.dither] | number | 1.0 | level of Floyd-Steinberg error diffusion, sets `palette` to `true` |
+| [options.force] | boolean | true | force PNG output, otherwise attempt to use input format |
+
+**Example**
+```js
+// Convert any input to full colour PNG output
+const data = await sharp(input)
+ .png()
+ .toBuffer();
+```
+**Example**
+```js
+// Convert any input to indexed PNG output (slower)
+const data = await sharp(input)
+ .png({ palette: true })
+ .toBuffer();
+```
+**Example**
+```js
+// Output 16 bits per pixel RGB(A)
+const data = await sharp(input)
+ .toColourspace('rgb16')
+ .png()
+ .toBuffer();
+```
+
+
+## webp
+> webp([options]) ⇒ Sharp
+
+Use these WebP options for output image.
+
+
+**Throws**:
+
+- Error Invalid options
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | output options |
+| [options.quality] | number | 80 | quality, integer 1-100 |
+| [options.alphaQuality] | number | 100 | quality of alpha layer, integer 0-100 |
+| [options.lossless] | boolean | false | use lossless compression mode |
+| [options.nearLossless] | boolean | false | use near_lossless compression mode |
+| [options.smartSubsample] | boolean | false | use high quality chroma subsampling |
+| [options.smartDeblock] | boolean | false | auto-adjust the deblocking filter, can improve low contrast edges (slow) |
+| [options.preset] | string | "'default'" | named preset for preprocessing/filtering, one of: default, photo, picture, drawing, icon, text |
+| [options.effort] | number | 4 | CPU effort, between 0 (fastest) and 6 (slowest) |
+| [options.loop] | number | 0 | number of animation iterations, use 0 for infinite animation |
+| [options.delay] | number \| Array.<number> | | delay(s) between animation frames (in milliseconds) |
+| [options.minSize] | boolean | false | prevent use of animation key frames to minimise file size (slow) |
+| [options.mixed] | boolean | false | allow mixture of lossy and lossless animation frames (slow) |
+| [options.force] | boolean | true | force WebP output, otherwise attempt to use input format |
+
+**Example**
+```js
+// Convert any input to lossless WebP output
+const data = await sharp(input)
+ .webp({ lossless: true })
+ .toBuffer();
+```
+**Example**
+```js
+// Optimise the file size of an animated WebP
+const outputWebp = await sharp(inputWebp, { animated: true })
+ .webp({ effort: 6 })
+ .toBuffer();
+```
+
+
+## gif
+> gif([options]) ⇒ Sharp
+
+Use these GIF options for the output image.
+
+The first entry in the palette is reserved for transparency.
+
+The palette of the input image will be re-used if possible.
+
+
+**Throws**:
+
+- Error Invalid options
+
+**Since**: 0.30.0
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | output options |
+| [options.reuse] | boolean | true | re-use existing palette, otherwise generate new (slow) |
+| [options.progressive] | boolean | false | use progressive (interlace) scan |
+| [options.colours] | number | 256 | maximum number of palette entries, including transparency, between 2 and 256 |
+| [options.colors] | number | 256 | alternative spelling of `options.colours` |
+| [options.effort] | number | 7 | CPU effort, between 1 (fastest) and 10 (slowest) |
+| [options.dither] | number | 1.0 | level of Floyd-Steinberg error diffusion, between 0 (least) and 1 (most) |
+| [options.interFrameMaxError] | number | 0 | maximum inter-frame error for transparency, between 0 (lossless) and 32 |
+| [options.interPaletteMaxError] | number | 3 | maximum inter-palette error for palette reuse, between 0 and 256 |
+| [options.keepDuplicateFrames] | boolean | false | keep duplicate frames in the output instead of combining them |
+| [options.loop] | number | 0 | number of animation iterations, use 0 for infinite animation |
+| [options.delay] | number \| Array.<number> | | delay(s) between animation frames (in milliseconds) |
+| [options.force] | boolean | true | force GIF output, otherwise attempt to use input format |
+
+**Example**
+```js
+// Convert PNG to GIF
+await sharp(pngBuffer)
+ .gif()
+ .toBuffer();
+```
+**Example**
+```js
+// Convert animated WebP to animated GIF
+await sharp('animated.webp', { animated: true })
+ .toFile('animated.gif');
+```
+**Example**
+```js
+// Create a 128x128, cropped, non-dithered, animated thumbnail of an animated GIF
+const out = await sharp('in.gif', { animated: true })
+ .resize({ width: 128, height: 128 })
+ .gif({ dither: 0 })
+ .toBuffer();
+```
+**Example**
+```js
+// Lossy file size reduction of animated GIF
+await sharp('in.gif', { animated: true })
+ .gif({ interFrameMaxError: 8 })
+ .toFile('optim.gif');
+```
+
+
+## jp2
+> jp2([options]) ⇒ Sharp
+
+Use these JP2 options for output image.
+
+Requires libvips compiled with support for OpenJPEG.
+The prebuilt binaries do not include this - see
+[installing a custom libvips](/install#custom-libvips).
+
+
+**Throws**:
+
+- Error Invalid options
+
+**Since**: 0.29.1
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | output options |
+| [options.quality] | number | 80 | quality, integer 1-100 |
+| [options.lossless] | boolean | false | use lossless compression mode |
+| [options.tileWidth] | number | 512 | horizontal tile size |
+| [options.tileHeight] | number | 512 | vertical tile size |
+| [options.chromaSubsampling] | string | "'4:4:4'" | set to '4:2:0' to use chroma subsampling |
+
+**Example**
+```js
+// Convert any input to lossless JP2 output
+const data = await sharp(input)
+ .jp2({ lossless: true })
+ .toBuffer();
+```
+**Example**
+```js
+// Convert any input to very high quality JP2 output
+const data = await sharp(input)
+ .jp2({
+ quality: 100,
+ chromaSubsampling: '4:4:4'
+ })
+ .toBuffer();
+```
+
+
+## tiff
+> tiff([options]) ⇒ Sharp
+
+Use these TIFF options for output image.
+
+The `density` can be set in pixels/inch via [withMetadata](#withmetadata)
+instead of providing `xres` and `yres` in pixels/mm.
+
+
+**Throws**:
+
+- Error Invalid options
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | output options |
+| [options.quality] | number | 80 | quality, integer 1-100 |
+| [options.force] | boolean | true | force TIFF output, otherwise attempt to use input format |
+| [options.compression] | string | "'jpeg'" | compression options: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k |
+| [options.bigtiff] | boolean | false | use BigTIFF variant (has no effect when compression is none) |
+| [options.predictor] | string | "'horizontal'" | compression predictor options: none, horizontal, float |
+| [options.pyramid] | boolean | false | write an image pyramid |
+| [options.tile] | boolean | false | write a tiled tiff |
+| [options.tileWidth] | number | 256 | horizontal tile size |
+| [options.tileHeight] | number | 256 | vertical tile size |
+| [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.miniswhite] | boolean | false | write 1-bit images as miniswhite |
+
+**Example**
+```js
+// Convert SVG input to LZW-compressed, 1 bit per pixel TIFF output
+sharp('input.svg')
+ .tiff({
+ compression: 'lzw',
+ bitdepth: 1
+ })
+ .toFile('1-bpp-output.tiff')
+ .then(info => { ... });
+```
+
+
+## avif
+> avif([options]) ⇒ Sharp
+
+Use these AVIF options for output image.
+
+AVIF image sequences are not supported.
+Prebuilt binaries support a bitdepth of 8 only.
+
+This feature is experimental on the Windows ARM64 platform
+and requires a CPU with ARM64v8.4 or later.
+
+
+**Throws**:
+
+- Error Invalid options
+
+**Since**: 0.27.0
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | output options |
+| [options.quality] | number | 50 | quality, integer 1-100 |
+| [options.lossless] | boolean | false | use lossless compression |
+| [options.effort] | number | 4 | CPU effort, between 0 (fastest) and 9 (slowest) |
+| [options.chromaSubsampling] | string | "'4:4:4'" | set to '4:2:0' to use chroma subsampling |
+| [options.bitdepth] | number | 8 | set bitdepth to 8, 10 or 12 bit |
+
+**Example**
+```js
+const data = await sharp(input)
+ .avif({ effort: 2 })
+ .toBuffer();
+```
+**Example**
+```js
+const data = await sharp(input)
+ .avif({ lossless: true })
+ .toBuffer();
+```
+
+
+## heif
+> heif(options) ⇒ Sharp
+
+Use these HEIF options for output image.
+
+Support for patent-encumbered HEIC images using `hevc` compression requires the use of a
+globally-installed libvips compiled with support for libheif, libde265 and x265.
+
+
+**Throws**:
+
+- Error Invalid options
+
+**Since**: 0.23.0
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| options | Object | | output options |
+| options.compression | string | | compression format: av1, hevc |
+| [options.quality] | number | 50 | quality, integer 1-100 |
+| [options.lossless] | boolean | false | use lossless compression |
+| [options.effort] | number | 4 | CPU effort, between 0 (fastest) and 9 (slowest) |
+| [options.chromaSubsampling] | string | "'4:4:4'" | set to '4:2:0' to use chroma subsampling |
+| [options.bitdepth] | number | 8 | set bitdepth to 8, 10 or 12 bit |
+
+**Example**
+```js
+const data = await sharp(input)
+ .heif({ compression: 'hevc' })
+ .toBuffer();
+```
+
+
+## jxl
+> jxl([options]) ⇒ Sharp
+
+Use these JPEG-XL (JXL) options for output image.
+
+This feature is experimental, please do not use in production systems.
+
+Requires libvips compiled with support for libjxl.
+The prebuilt binaries do not include this - see
+[installing a custom libvips](/install/#custom-libvips).
+
+
+**Throws**:
+
+- Error Invalid options
+
+**Since**: 0.31.3
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | output options |
+| [options.distance] | number | 1.0 | maximum encoding error, between 0 (highest quality) and 15 (lowest quality) |
+| [options.quality] | number | | calculate `distance` based on JPEG-like quality, between 1 and 100, overrides distance if specified |
+| [options.decodingTier] | number | 0 | target decode speed tier, between 0 (highest quality) and 4 (lowest quality) |
+| [options.lossless] | boolean | false | use lossless compression |
+| [options.effort] | number | 7 | CPU effort, between 1 (fastest) and 9 (slowest) |
+| [options.loop] | number | 0 | number of animation iterations, use 0 for infinite animation |
+| [options.delay] | number \| Array.<number> | | delay(s) between animation frames (in milliseconds) |
+
+
+
+## raw
+> raw([options]) ⇒ Sharp
+
+Force output to be raw, uncompressed pixel data.
+Pixel ordering is left-to-right, top-to-bottom, without padding.
+Channel ordering will be RGB or RGBA for non-greyscale colourspaces.
+
+
+**Throws**:
+
+- Error Invalid options
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | output options |
+| [options.depth] | string | "'uchar'" | bit depth, one of: char, uchar (default), short, ushort, int, uint, float, complex, double, dpcomplex |
+
+**Example**
+```js
+// Extract raw, unsigned 8-bit RGB pixel data from JPEG input
+const { data, info } = await sharp('input.jpg')
+ .raw()
+ .toBuffer({ resolveWithObject: true });
+```
+**Example**
+```js
+// Extract alpha channel as raw, unsigned 16-bit pixel data from PNG input
+const data = await sharp('input.png')
+ .ensureAlpha()
+ .extractChannel(3)
+ .toColourspace('b-w')
+ .raw({ depth: 'ushort' })
+ .toBuffer();
+```
+
+
+## tile
+> tile([options]) ⇒ Sharp
+
+Use tile-based deep zoom (image pyramid) output.
+
+Set the format and options for tile images via the `toFormat`, `jpeg`, `png` or `webp` functions.
+Use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
+
+The container will be set to `zip` when the output is a Buffer or Stream, otherwise it will default to `fs`.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | |
+| [options.size] | number | 256 | tile size in pixels, a value between 1 and 8192. |
+| [options.overlap] | number | 0 | tile overlap in pixels, a value between 0 and 8192. |
+| [options.angle] | number | 0 | tile angle of rotation, must be a multiple of 90. |
+| [options.background] | string \| Object | "{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. |
+| [options.depth] | string | | how deep to make the pyramid, possible values are `onepixel`, `onetile` or `one`, default based on layout. |
+| [options.skipBlanks] | number | -1 | Threshold to skip tile generation. Range is 0-255 for 8-bit images, 0-65535 for 16-bit images. Default is 5 for `google` layout, -1 (no skip) otherwise. |
+| [options.container] | string | "'fs'" | tile container, with value `fs` (filesystem) or `zip` (compressed file). |
+| [options.layout] | string | "'dz'" | filesystem layout, possible values are `dz`, `iiif`, `iiif3`, `zoomify` or `google`. |
+| [options.centre] | boolean | false | centre image in tile. |
+| [options.center] | boolean | false | alternative spelling of centre. |
+| [options.id] | string | "'https://example.com/iiif'" | when `layout` is `iiif`/`iiif3`, sets the `@id`/`id` attribute of `info.json` |
+| [options.basename] | string | | the name of the directory within the zip file when container is `zip`. |
+
+**Example**
+```js
+sharp('input.tiff')
+ .png()
+ .tile({
+ size: 512
+ })
+ .toFile('output.dz', function(err, info) {
+ // output.dzi is the Deep Zoom XML definition
+ // output_files contains 512x512 tiles grouped by zoom level
+ });
+```
+**Example**
+```js
+const zipFileWithTiles = await sharp(input)
+ .tile({ basename: "tiles" })
+ .toBuffer();
+```
+**Example**
+```js
+const iiififier = sharp().tile({ layout: "iiif" });
+readableStream
+ .pipe(iiififier)
+ .pipe(writeableStream);
+```
+
+
+## timeout
+> timeout(options) ⇒ Sharp
+
+Set a timeout for processing, in seconds.
+Use a value of zero to continue processing indefinitely, the default behaviour.
+
+The clock starts when libvips opens an input image for processing.
+Time spent waiting for a libuv thread to become available is not included.
+
+
+**Since**: 0.29.2
+
+| Param | Type | Description |
+| --- | --- | --- |
+| options | Object | |
+| options.seconds | number | Number of seconds after which processing will be stopped |
+
+**Example**
+```js
+// Ensure processing takes no longer than 3 seconds
+try {
+ const data = await sharp(input)
+ .blur(1000)
+ .timeout({ seconds: 3 })
+ .toBuffer();
+} catch (err) {
+ if (err.message.includes('timeout')) { ... }
+}
+```
\ No newline at end of file
diff --git a/docs/src/content/docs/api-resize.md b/docs/src/content/docs/api-resize.md
new file mode 100644
index 000000000..6452c3455
--- /dev/null
+++ b/docs/src/content/docs/api-resize.md
@@ -0,0 +1,323 @@
+---
+# This file was auto-generated from JSDoc in lib/resize.js
+title: Resizing images
+---
+
+## resize
+> resize([width], [height], [options]) ⇒ Sharp
+
+Resize image to `width`, `height` or `width x height`.
+
+When both a `width` and `height` are provided, the possible methods by which the image should **fit** these are:
+- `cover`: (default) Preserving aspect ratio, attempt to ensure the image covers both provided dimensions by cropping/clipping to fit.
+- `contain`: Preserving aspect ratio, contain within both provided dimensions using "letterboxing" where necessary.
+- `fill`: Ignore the aspect ratio of the input and stretch to both provided dimensions.
+- `inside`: Preserving aspect ratio, resize the image to be as large as possible while ensuring its dimensions are less than or equal to both those specified.
+- `outside`: Preserving aspect ratio, resize the image to be as small as possible while ensuring its dimensions are greater than or equal to both those specified.
+
+Some of these values are based on the [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property.
+
+
+
+When using a **fit** of `cover` or `contain`, the default **position** is `centre`. Other options are:
+- `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`.
+- `sharp.gravity`: `north`, `northeast`, `east`, `southeast`, `south`, `southwest`, `west`, `northwest`, `center` or `centre`.
+- `sharp.strategy`: `cover` only, dynamically crop using either the `entropy` or `attention` strategy.
+
+Some of these values are based on the [object-position](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position) CSS property.
+
+The strategy-based approach initially resizes so one dimension is at its target length
+then repeatedly ranks edge regions, discarding the edge with the lowest score based on the selected strategy.
+- `entropy`: focus on the region with the highest [Shannon entropy](https://en.wikipedia.org/wiki/Entropy_%28information_theory%29).
+- `attention`: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.
+
+Possible downsizing kernels are:
+- `nearest`: Use [nearest neighbour interpolation](http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation).
+- `linear`: Use a [triangle filter](https://en.wikipedia.org/wiki/Triangular_function).
+- `cubic`: Use a [Catmull-Rom spline](https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline).
+- `mitchell`: Use a [Mitchell-Netravali spline](https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf).
+- `lanczos2`: Use a [Lanczos kernel](https://en.wikipedia.org/wiki/Lanczos_resampling#Lanczos_kernel) with `a=2`.
+- `lanczos3`: Use a Lanczos kernel with `a=3` (the default).
+- `mks2013`: Use a [Magic Kernel Sharp](https://johncostella.com/magic/mks.pdf) 2013 kernel, as adopted by Facebook.
+- `mks2021`: Use a Magic Kernel Sharp 2021 kernel, with more accurate (reduced) sharpening than the 2013 version.
+
+When upsampling, these kernels map to `nearest`, `linear` and `cubic` interpolators.
+Downsampling kernels without a matching upsampling interpolator map to `cubic`.
+
+Only one resize can occur per pipeline.
+Previous calls to `resize` in the same pipeline will be ignored.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [width] | number | | How many pixels wide the resultant image should be. Use `null` or `undefined` to auto-scale the width to match the height. |
+| [height] | number | | How many pixels high the resultant image should be. Use `null` or `undefined` to auto-scale the height to match the width. |
+| [options] | Object | | |
+| [options.width] | number | | An alternative means of specifying `width`. If both are present this takes priority. |
+| [options.height] | number | | An alternative means of specifying `height`. If both are present this takes priority. |
+| [options.fit] | String | 'cover' | How the image should be resized/cropped to fit the target dimension(s), one of `cover`, `contain`, `fill`, `inside` or `outside`. |
+| [options.position] | String | 'centre' | A position, gravity or strategy to use when `fit` is `cover` or `contain`. |
+| [options.background] | String \| Object | {r: 0, g: 0, b: 0, alpha: 1} | background colour when `fit` is `contain`, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black without transparency. |
+| [options.kernel] | String | 'lanczos3' | The kernel to use for image reduction and the inferred interpolator to use for upsampling. Use the `fastShrinkOnLoad` option to control kernel vs shrink-on-load. |
+| [options.withoutEnlargement] | Boolean | false | Do not scale up if the width *or* height are already less than the target dimensions, equivalent to GraphicsMagick's `>` geometry option. This may result in output dimensions smaller than the target dimensions. |
+| [options.withoutReduction] | Boolean | false | Do not scale down if the width *or* height are already greater than the target dimensions, equivalent to GraphicsMagick's `<` geometry option. This may still result in a crop to reach the target dimensions. |
+| [options.fastShrinkOnLoad] | Boolean | true | Take greater advantage of the JPEG and WebP shrink-on-load feature, which can lead to a slight moiré pattern or round-down of an auto-scaled dimension. |
+
+**Example**
+```js
+sharp(input)
+ .resize({ width: 100 })
+ .toBuffer()
+ .then(data => {
+ // 100 pixels wide, auto-scaled height
+ });
+```
+**Example**
+```js
+sharp(input)
+ .resize({ height: 100 })
+ .toBuffer()
+ .then(data => {
+ // 100 pixels high, auto-scaled width
+ });
+```
+**Example**
+```js
+sharp(input)
+ .resize(200, 300, {
+ kernel: sharp.kernel.nearest,
+ fit: 'contain',
+ position: 'right top',
+ background: { r: 255, g: 255, b: 255, alpha: 0.5 }
+ })
+ .toFile('output.png')
+ .then(() => {
+ // output.png is a 200 pixels wide and 300 pixels high image
+ // containing a nearest-neighbour scaled version
+ // contained within the north-east corner of a semi-transparent white canvas
+ });
+```
+**Example**
+```js
+const transformer = sharp()
+ .resize({
+ width: 200,
+ height: 200,
+ fit: sharp.fit.cover,
+ position: sharp.strategy.entropy
+ });
+// Read image data from readableStream
+// Write 200px square auto-cropped image data to writableStream
+readableStream
+ .pipe(transformer)
+ .pipe(writableStream);
+```
+**Example**
+```js
+sharp(input)
+ .resize(200, 200, {
+ fit: sharp.fit.inside,
+ withoutEnlargement: true
+ })
+ .toFormat('jpeg')
+ .toBuffer()
+ .then(function(outputBuffer) {
+ // outputBuffer contains JPEG image data
+ // no wider and no higher than 200 pixels
+ // and no larger than the input image
+ });
+```
+**Example**
+```js
+sharp(input)
+ .resize(200, 200, {
+ fit: sharp.fit.outside,
+ withoutReduction: true
+ })
+ .toFormat('jpeg')
+ .toBuffer()
+ .then(function(outputBuffer) {
+ // outputBuffer contains JPEG image data
+ // of at least 200 pixels wide and 200 pixels high while maintaining aspect ratio
+ // and no smaller than the input image
+ });
+```
+**Example**
+```js
+const scaleByHalf = await sharp(input)
+ .metadata()
+ .then(({ width }) => sharp(input)
+ .resize(Math.round(width * 0.5))
+ .toBuffer()
+ );
+```
+
+
+## extend
+> extend(extend) ⇒ Sharp
+
+Extend / pad / extrude one or more edges of the image with either
+the provided background colour or pixels derived from the image.
+This operation will always occur after resizing and extraction, if any.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| extend | number \| Object | | single pixel count to add to all edges or an Object with per-edge counts |
+| [extend.top] | number | 0 | |
+| [extend.left] | number | 0 | |
+| [extend.bottom] | number | 0 | |
+| [extend.right] | number | 0 | |
+| [extend.extendWith] | String | 'background' | populate new pixels using this method, one of: background, copy, repeat, mirror. |
+| [extend.background] | String \| Object | {r: 0, g: 0, b: 0, alpha: 1} | background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black without transparency. |
+
+**Example**
+```js
+// Resize to 140 pixels wide, then add 10 transparent pixels
+// to the top, left and right edges and 20 to the bottom edge
+sharp(input)
+ .resize(140)
+ .extend({
+ top: 10,
+ bottom: 20,
+ left: 10,
+ right: 10,
+ background: { r: 0, g: 0, b: 0, alpha: 0 }
+ })
+ ...
+```
+**Example**
+```js
+// Add a row of 10 red pixels to the bottom
+sharp(input)
+ .extend({
+ bottom: 10,
+ background: 'red'
+ })
+ ...
+```
+**Example**
+```js
+// Extrude image by 8 pixels to the right, mirroring existing right hand edge
+sharp(input)
+ .extend({
+ right: 8,
+ background: 'mirror'
+ })
+ ...
+```
+
+
+## extract
+> extract(options) ⇒ Sharp
+
+Extract/crop a region of the image.
+
+- Use `extract` before `resize` for pre-resize extraction.
+- Use `extract` after `resize` for post-resize extraction.
+- Use `extract` twice and `resize` once for extract-then-resize-then-extract in a fixed operation order.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| options | Object | describes the region to extract using integral pixel values |
+| options.left | number | zero-indexed offset from left edge |
+| options.top | number | zero-indexed offset from top edge |
+| options.width | number | width of region to extract |
+| options.height | number | height of region to extract |
+
+**Example**
+```js
+sharp(input)
+ .extract({ left: left, top: top, width: width, height: height })
+ .toFile(output, function(err) {
+ // Extract a region of the input image, saving in the same format.
+ });
+```
+**Example**
+```js
+sharp(input)
+ .extract({ left: leftOffsetPre, top: topOffsetPre, width: widthPre, height: heightPre })
+ .resize(width, height)
+ .extract({ left: leftOffsetPost, top: topOffsetPost, width: widthPost, height: heightPost })
+ .toFile(output, function(err) {
+ // Extract a region, resize, then extract from the resized image
+ });
+```
+
+
+## trim
+> trim([options]) ⇒ Sharp
+
+Trim pixels from all edges that contain values similar to the given background colour, which defaults to that of the top-left pixel.
+
+Images with an alpha channel will use the combined bounding box of alpha and non-alpha channels.
+
+If the result of this operation would trim an image to nothing then no change is made.
+
+The `info` response Object will contain `trimOffsetLeft` and `trimOffsetTop` properties.
+
+
+**Throws**:
+
+- Error Invalid parameters
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object | | |
+| [options.background] | string \| Object | "'top-left pixel'" | Background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to that of the top-left pixel. |
+| [options.threshold] | number | 10 | Allowed difference from the above colour, a positive number. |
+| [options.lineArt] | boolean | false | Does the input more closely resemble line art (e.g. vector) rather than being photographic? |
+
+**Example**
+```js
+// Trim pixels with a colour similar to that of the top-left pixel.
+await sharp(input)
+ .trim()
+ .toFile(output);
+```
+**Example**
+```js
+// Trim pixels with the exact same colour as that of the top-left pixel.
+await sharp(input)
+ .trim({
+ threshold: 0
+ })
+ .toFile(output);
+```
+**Example**
+```js
+// Assume input is line art and trim only pixels with a similar colour to red.
+const output = await sharp(input)
+ .trim({
+ background: "#FF0000",
+ lineArt: true
+ })
+ .toBuffer();
+```
+**Example**
+```js
+// Trim all "yellow-ish" pixels, being more lenient with the higher threshold.
+const output = await sharp(input)
+ .trim({
+ background: "yellow",
+ threshold: 42,
+ })
+ .toBuffer();
+```
\ No newline at end of file
diff --git a/docs/src/content/docs/api-utility.md b/docs/src/content/docs/api-utility.md
new file mode 100644
index 000000000..73190fd01
--- /dev/null
+++ b/docs/src/content/docs/api-utility.md
@@ -0,0 +1,232 @@
+---
+# This file was auto-generated from JSDoc in lib/utility.js
+title: Global properties
+---
+
+## versions
+> versions
+
+An Object containing the version numbers of sharp, libvips
+and (when using prebuilt binaries) its dependencies.
+
+
+**Example**
+```js
+console.log(sharp.versions);
+```
+
+
+## interpolators
+> interpolators : enum
+
+An Object containing the available interpolators and their proper values
+
+
+**Read only**: true
+**Properties**
+
+| Name | Type | Default | Description |
+| --- | --- | --- | --- |
+| nearest | string | "nearest" | [Nearest neighbour interpolation](http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation). Suitable for image enlargement only. |
+| bilinear | string | "bilinear" | [Bilinear interpolation](http://en.wikipedia.org/wiki/Bilinear_interpolation). Faster than bicubic but with less smooth results. |
+| bicubic | string | "bicubic" | [Bicubic interpolation](http://en.wikipedia.org/wiki/Bicubic_interpolation) (the default). |
+| locallyBoundedBicubic | string | "lbb" | [LBB interpolation](https://github.com/libvips/libvips/blob/master/libvips/resample/lbb.cpp#L100). Prevents some "[acutance](http://en.wikipedia.org/wiki/Acutance)" but typically reduces performance by a factor of 2. |
+| nohalo | string | "nohalo" | [Nohalo interpolation](http://eprints.soton.ac.uk/268086/). Prevents acutance but typically reduces performance by a factor of 3. |
+| vertexSplitQuadraticBasisSpline | string | "vsqbs" | [VSQBS interpolation](https://github.com/libvips/libvips/blob/master/libvips/resample/vsqbs.cpp#L48). Prevents "staircasing" when enlarging. |
+
+
+
+## format
+> format ⇒ Object
+
+An Object containing nested boolean values representing the available input and output formats/methods.
+
+
+**Example**
+```js
+console.log(sharp.format);
+```
+
+
+## queue
+> queue
+
+An EventEmitter that emits a `change` event when a task is either:
+- queued, waiting for _libuv_ to provide a worker thread
+- complete
+
+
+**Example**
+```js
+sharp.queue.on('change', function(queueLength) {
+ console.log('Queue contains ' + queueLength + ' task(s)');
+});
+```
+
+
+## cache
+> cache([options]) ⇒ Object
+
+Gets or, when options are provided, sets the limits of _libvips'_ operation cache.
+Existing entries in the cache will be trimmed after any change in limits.
+This method always returns cache statistics,
+useful for determining how much working memory is required for a particular task.
+
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [options] | Object \| boolean | true | Object with the following attributes, or boolean where true uses default cache settings and false removes all caching |
+| [options.memory] | number | 50 | is the maximum memory in MB to use for this cache |
+| [options.files] | number | 20 | is the maximum number of files to hold open |
+| [options.items] | number | 100 | is the maximum number of operations to cache |
+
+**Example**
+```js
+const stats = sharp.cache();
+```
+**Example**
+```js
+sharp.cache( { items: 200 } );
+sharp.cache( { files: 0 } );
+sharp.cache(false);
+```
+
+
+## concurrency
+> concurrency([concurrency]) ⇒ number
+
+Gets or, when a concurrency is provided, sets
+the maximum number of threads _libvips_ should use to process _each image_.
+These are from a thread pool managed by glib,
+which helps avoid the overhead of creating new threads.
+
+This method always returns the current concurrency.
+
+The default value is the number of CPU cores,
+except when using glibc-based Linux without jemalloc,
+where the default is `1` to help reduce memory fragmentation.
+
+A value of `0` will reset this to the number of CPU cores.
+
+Some image format libraries spawn additional threads,
+e.g. libaom manages its own 4 threads when encoding AVIF images,
+and these are independent of the value set here.
+
+:::note
+Further [control over performance](/performance/) is available.
+:::
+
+
+**Returns**: number - concurrency
+
+| Param | Type |
+| --- | --- |
+| [concurrency] | number |
+
+**Example**
+```js
+const threads = sharp.concurrency(); // 4
+sharp.concurrency(2); // 2
+sharp.concurrency(0); // 4
+```
+
+
+## counters
+> counters() ⇒ Object
+
+Provides access to internal task counters.
+- queue is the number of tasks this module has queued waiting for _libuv_ to provide a worker thread from its pool.
+- process is the number of resize tasks currently being processed.
+
+
+**Example**
+```js
+const counters = sharp.counters(); // { queue: 2, process: 4 }
+```
+
+
+## simd
+> simd([simd]) ⇒ boolean
+
+Get and set use of SIMD vector unit instructions.
+Requires libvips to have been compiled with highway support.
+
+Improves the performance of `resize`, `blur` and `sharpen` operations
+by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
+
+
+
+| Param | Type | Default |
+| --- | --- | --- |
+| [simd] | boolean | true |
+
+**Example**
+```js
+const simd = sharp.simd();
+// simd is `true` if the runtime use of highway is currently enabled
+```
+**Example**
+```js
+const simd = sharp.simd(false);
+// prevent libvips from using highway at runtime
+```
+
+
+## block
+> block(options)
+
+Block libvips operations at runtime.
+
+This is in addition to the `VIPS_BLOCK_UNTRUSTED` environment variable,
+which when set will block all "untrusted" operations.
+
+
+**Since**: 0.32.4
+
+| Param | Type | Description |
+| --- | --- | --- |
+| options | Object | |
+| options.operation | Array.<string> | List of libvips low-level operation names to block. |
+
+**Example** *(Block all TIFF input.)*
+```js
+sharp.block({
+ operation: ['VipsForeignLoadTiff']
+});
+```
+
+
+## unblock
+> unblock(options)
+
+Unblock libvips operations at runtime.
+
+This is useful for defining a list of allowed operations.
+
+
+**Since**: 0.32.4
+
+| Param | Type | Description |
+| --- | --- | --- |
+| options | Object | |
+| options.operation | Array.<string> | List of libvips low-level operation names to unblock. |
+
+**Example** *(Block all input except WebP from the filesystem.)*
+```js
+sharp.block({
+ operation: ['VipsForeignLoad']
+});
+sharp.unblock({
+ operation: ['VipsForeignLoadWebpFile']
+});
+```
+**Example** *(Block all input except JPEG and PNG from a Buffer or Stream.)*
+```js
+sharp.block({
+ operation: ['VipsForeignLoad']
+});
+sharp.unblock({
+ operation: ['VipsForeignLoadJpegBuffer', 'VipsForeignLoadPngBuffer']
+});
+```
\ No newline at end of file
diff --git a/docs/src/content/docs/changelog/_meta.yml b/docs/src/content/docs/changelog/_meta.yml
new file mode 100644
index 000000000..5dd257241
--- /dev/null
+++ b/docs/src/content/docs/changelog/_meta.yml
@@ -0,0 +1 @@
+sort: reverse-slug
diff --git a/docs/src/content/docs/changelog/v0.10.0.md b/docs/src/content/docs/changelog/v0.10.0.md
new file mode 100644
index 000000000..aae2ca0ee
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.10.0.md
@@ -0,0 +1,22 @@
+---
+title: v0.10.0 - 23rd April 2015
+slug: changelog/v0.10.0
+---
+
+* Add support for Windows (x86).
+ [#19](https://github.com/lovell/sharp/issues/19)
+ [@DullReferenceException](https://github.com/DullReferenceException)
+ [@itsananderson](https://github.com/itsananderson)
+
+* Add support for Openslide input and DeepZoom output.
+ [#146](https://github.com/lovell/sharp/issues/146)
+ [@mvictoras](https://github.com/mvictoras)
+
+* Allow arbitrary aspect ratios when resizing images via new `ignoreAspectRatio` method.
+ [#192](https://github.com/lovell/sharp/issues/192)
+ [@skedastik](https://github.com/skedastik)
+
+* Enhance output image contrast by stretching its luminance to cover the full dynamic range via new `normalize` method.
+ [#194](https://github.com/lovell/sharp/issues/194)
+ [@bkw](https://github.com/bkw)
+ [@codingforce](https://github.com/codingforce)
diff --git a/docs/src/content/docs/changelog/v0.10.1.md b/docs/src/content/docs/changelog/v0.10.1.md
new file mode 100644
index 000000000..6f0336861
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.10.1.md
@@ -0,0 +1,12 @@
+---
+title: v0.10.1 - 1st June 2015
+slug: changelog/v0.10.1
+---
+
+* Allow embed of image with alpha transparency onto non-transparent background.
+ [#204](https://github.com/lovell/sharp/issues/204)
+ [@mikemliu](https://github.com/mikemliu)
+
+* Include C standard library for `atoi` as Xcode 6.3 appears to no longer do this.
+ [#228](https://github.com/lovell/sharp/issues/228)
+ [@doggan](https://github.com/doggan)
diff --git a/docs/src/content/docs/changelog/v0.11.0.md b/docs/src/content/docs/changelog/v0.11.0.md
new file mode 100644
index 000000000..2b07a93a5
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.11.0.md
@@ -0,0 +1,30 @@
+---
+title: v0.11.0 - 15th July 2015
+slug: changelog/v0.11.0
+---
+
+* Allow alpha transparency compositing via new `overlayWith` method.
+ [#97](https://github.com/lovell/sharp/issues/97)
+ [@gasi](https://github.com/gasi)
+
+* Expose raw ICC profile data as a Buffer when using `metadata`.
+ [#129](https://github.com/lovell/sharp/issues/129)
+ [@homerjam](https://github.com/homerjam)
+
+* Allow image header updates via a parameter passed to existing `withMetadata` method.
+ Provide initial support for EXIF `Orientation` tag,
+ which if present is now removed when using `rotate`, `flip` or `flop`.
+ [#189](https://github.com/lovell/sharp/issues/189)
+ [@h2non](https://github.com/h2non)
+
+* Tighten constructor parameter checks.
+ [#221](https://github.com/lovell/sharp/issues/221)
+ [@mikemorris](https://github.com/mikemorris)
+
+* Allow one input Stream to be shared with two or more output Streams via new `clone` method.
+ [#235](https://github.com/lovell/sharp/issues/235)
+ [@jaubourg](https://github.com/jaubourg)
+
+* Use `round` instead of `floor` when auto-scaling dimensions to avoid floating-point rounding errors.
+ [#238](https://github.com/lovell/sharp/issues/238)
+ [@richardadjogah](https://github.com/richardadjogah)
diff --git a/docs/src/content/docs/changelog/v0.11.1.md b/docs/src/content/docs/changelog/v0.11.1.md
new file mode 100644
index 000000000..44bdfc925
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.11.1.md
@@ -0,0 +1,12 @@
+---
+title: v0.11.1 - 12th August 2015
+slug: changelog/v0.11.1
+---
+
+* Silence MSVC warning: "C4530: C++ exception handler used, but unwind semantics are not enabled".
+ [#244](https://github.com/lovell/sharp/pull/244)
+ [@TheThing](https://github.com/TheThing)
+
+* Suppress gamma correction for input image with alpha transparency.
+ [#249](https://github.com/lovell/sharp/issues/249)
+ [@compeak](https://github.com/compeak)
diff --git a/docs/src/content/docs/changelog/v0.11.2.md b/docs/src/content/docs/changelog/v0.11.2.md
new file mode 100644
index 000000000..9990b05f7
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.11.2.md
@@ -0,0 +1,10 @@
+---
+title: v0.11.2 - 28th August 2015
+slug: changelog/v0.11.2
+---
+
+* Allow crop gravity to be provided as a String.
+ [#255](https://github.com/lovell/sharp/pull/255)
+ [@papandreou](https://github.com/papandreou)
+* Add support for io.js v3 and Node v4.
+ [#246](https://github.com/lovell/sharp/issues/246)
diff --git a/docs/src/content/docs/changelog/v0.11.3.md b/docs/src/content/docs/changelog/v0.11.3.md
new file mode 100644
index 000000000..a062d1b8b
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.11.3.md
@@ -0,0 +1,8 @@
+---
+title: v0.11.3 - 8th September 2015
+slug: changelog/v0.11.3
+---
+
+* Intrepret blurSigma, sharpenFlat, and sharpenJagged as double precision.
+ [#263](https://github.com/lovell/sharp/pull/263)
+ [@chrisriley](https://github.com/chrisriley)
diff --git a/docs/src/content/docs/changelog/v0.11.4.md b/docs/src/content/docs/changelog/v0.11.4.md
new file mode 100644
index 000000000..f8cba2cd6
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.11.4.md
@@ -0,0 +1,16 @@
+---
+title: v0.11.4 - 5th November 2015
+slug: changelog/v0.11.4
+---
+
+* Add corners, e.g. `northeast`, to existing `gravity` option.
+ [#291](https://github.com/lovell/sharp/pull/291)
+ [@brandonaaron](https://github.com/brandonaaron)
+
+* Ensure correct auto-rotation for EXIF Orientation values 2 and 4.
+ [#288](https://github.com/lovell/sharp/pull/288)
+ [@brandonaaron](https://github.com/brandonaaron)
+
+* Make static linking possible via `--runtime_link` install option.
+ [#287](https://github.com/lovell/sharp/pull/287)
+ [@vlapo](https://github.com/vlapo)
diff --git a/docs/src/content/docs/changelog/v0.12.0.md b/docs/src/content/docs/changelog/v0.12.0.md
new file mode 100644
index 000000000..c081be9de
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.12.0.md
@@ -0,0 +1,38 @@
+---
+title: v0.12.0 - 23rd November 2015
+slug: changelog/v0.12.0
+---
+
+* Bundle pre-compiled libvips and its dependencies for 64-bit Linux and Windows.
+ [#42](https://github.com/lovell/sharp/issues/42)
+
+* Take advantage of libvips v8.1.0+ features.
+ [#152](https://github.com/lovell/sharp/issues/152)
+
+* Add support for 64-bit Windows. Drop support for 32-bit Windows.
+ [#224](https://github.com/lovell/sharp/issues/224)
+ [@sabrehagen](https://github.com/sabrehagen)
+
+* Switch default interpolator to bicubic.
+ [#289](https://github.com/lovell/sharp/issues/289)
+ [@mahnunchik](https://github.com/mahnunchik)
+
+* Pre-extract rotatation should not swap width/height.
+ [#296](https://github.com/lovell/sharp/issues/296)
+ [@asilvas](https://github.com/asilvas)
+
+* Ensure 16-bit+alpha input images are (un)premultiplied correctly.
+ [#301](https://github.com/lovell/sharp/issues/301)
+ [@izaakschroeder](https://github.com/izaakschroeder)
+
+* Add `threshold` operation.
+ [#303](https://github.com/lovell/sharp/pull/303)
+ [@dacarley](https://github.com/dacarley)
+
+* Add `negate` operation.
+ [#306](https://github.com/lovell/sharp/pull/306)
+ [@dacarley](https://github.com/dacarley)
+
+* Support `options` Object with existing `extract` operation.
+ [#309](https://github.com/lovell/sharp/pull/309)
+ [@papandreou](https://github.com/papandreou)
diff --git a/docs/src/content/docs/changelog/v0.12.1.md b/docs/src/content/docs/changelog/v0.12.1.md
new file mode 100644
index 000000000..61fb46a80
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.12.1.md
@@ -0,0 +1,15 @@
+---
+title: v0.12.1 - 12th December 2015
+slug: changelog/v0.12.1
+---
+
+* Allow use of SIMD vector instructions (via liborc) to be toggled on/off.
+ [#172](https://github.com/lovell/sharp/issues/172)
+ [@bkw](https://github.com/bkw)
+ [@puzrin](https://github.com/puzrin)
+
+* Ensure embedded ICC profiles output with perceptual intent.
+ [#321](https://github.com/lovell/sharp/issues/321)
+ [@vlapo](https://github.com/vlapo)
+
+* Use the NPM-configured HTTPS proxy, if any, for binary downloads.
diff --git a/docs/src/content/docs/changelog/v0.12.2.md b/docs/src/content/docs/changelog/v0.12.2.md
new file mode 100644
index 000000000..91dd927de
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.12.2.md
@@ -0,0 +1,20 @@
+---
+title: v0.12.2 - 16th January 2016
+slug: changelog/v0.12.2
+---
+
+* Upgrade libvips to v8.2.0 for improved vips_shrink.
+
+* Add pre-compiled libvips for ARMv6+ CPUs.
+
+* Ensure 16-bit input images work with embed option.
+ [#325](https://github.com/lovell/sharp/issues/325)
+ [@janaz](https://github.com/janaz)
+
+* Allow compilation with gmake to provide FreeBSD support.
+ [#326](https://github.com/lovell/sharp/issues/326)
+ [@c0decafe](https://github.com/c0decafe)
+
+* Attempt to remove temporary file after installation.
+ [#331](https://github.com/lovell/sharp/issues/331)
+ [@dtoubelis](https://github.com/dtoubelis)
diff --git a/docs/src/content/docs/changelog/v0.13.0.md b/docs/src/content/docs/changelog/v0.13.0.md
new file mode 100644
index 000000000..f1c989a6b
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.13.0.md
@@ -0,0 +1,47 @@
+---
+title: v0.13.0 - 15th February 2016
+slug: changelog/v0.13.0
+---
+
+* Improve vector image support by allowing control of density/DPI.
+ Switch pre-built libs from Imagemagick to Graphicsmagick.
+ [#110](https://github.com/lovell/sharp/issues/110)
+ [@bradisbell](https://github.com/bradisbell)
+
+* Add support for raw, uncompressed pixel Buffer/Stream input.
+ [#220](https://github.com/lovell/sharp/issues/220)
+ [@mikemorris](https://github.com/mikemorris)
+
+* Switch from libvips' C to C++ bindings, requires upgrade to v8.2.2.
+ [#299](https://github.com/lovell/sharp/issues/299)
+
+* Control number of open files in libvips' cache; breaks existing `cache` behaviour.
+ [#315](https://github.com/lovell/sharp/issues/315)
+ [@impomezia](https://github.com/impomezia)
+
+* Ensure 16-bit input images can be normalised and embedded onto transparent backgrounds.
+ [#339](https://github.com/lovell/sharp/issues/339)
+ [#340](https://github.com/lovell/sharp/issues/340)
+ [@janaz](https://github.com/janaz)
+
+* Ensure selected format takes precedence over any unknown output filename extension.
+ [#344](https://github.com/lovell/sharp/issues/344)
+ [@ubaltaci](https://github.com/ubaltaci)
+
+* Add support for libvips' PBM, PGM, PPM and FITS image format loaders.
+ [#347](https://github.com/lovell/sharp/issues/347)
+ [@oaleynik](https://github.com/oaleynik)
+
+* Ensure default crop gravity is center/centre.
+ [#351](https://github.com/lovell/sharp/pull/351)
+ [@joelmukuthu](https://github.com/joelmukuthu)
+
+* Improve support for musl libc systems e.g. Alpine Linux.
+ [#354](https://github.com/lovell/sharp/issues/354)
+ [#359](https://github.com/lovell/sharp/pull/359)
+ [@download13](https://github.com/download13)
+ [@wjordan](https://github.com/wjordan)
+
+* Small optimisation when reducing by an integral factor to favour shrink over affine.
+
+* Add support for gamma correction of images with an alpha channel.
diff --git a/docs/src/content/docs/changelog/v0.13.1.md b/docs/src/content/docs/changelog/v0.13.1.md
new file mode 100644
index 000000000..cbaf11ec5
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.13.1.md
@@ -0,0 +1,8 @@
+---
+title: v0.13.1 - 27th February 2016
+slug: changelog/v0.13.1
+---
+
+* Fix embedding onto transparent backgrounds; regression introduced in v0.13.0.
+ [#366](https://github.com/lovell/sharp/issues/366)
+ [@diegocsandrim](https://github.com/diegocsandrim)
diff --git a/docs/src/content/docs/changelog/v0.14.0.md b/docs/src/content/docs/changelog/v0.14.0.md
new file mode 100644
index 000000000..a23f2e7f0
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.14.0.md
@@ -0,0 +1,39 @@
+---
+title: v0.14.0 - 2nd April 2016
+slug: changelog/v0.14.0
+---
+
+* Add ability to extend (pad) the edges of an image.
+ [#128](https://github.com/lovell/sharp/issues/128)
+ [@blowsie](https://github.com/blowsie)
+
+* Add support for Zoomify and Google tile layouts. Breaks existing tile API.
+ [#223](https://github.com/lovell/sharp/issues/223)
+ [@bdunnette](https://github.com/bdunnette)
+
+* Improvements to overlayWith: differing sizes/formats, gravity, buffer input.
+ [#239](https://github.com/lovell/sharp/issues/239)
+ [@chrisriley](https://github.com/chrisriley)
+
+* Add entropy-based crop strategy to remove least interesting edges.
+ [#295](https://github.com/lovell/sharp/issues/295)
+ [@rightaway](https://github.com/rightaway)
+
+* Expose density metadata; set density of images from vector input.
+ [#338](https://github.com/lovell/sharp/issues/338)
+ [@lookfirst](https://github.com/lookfirst)
+
+* Emit post-processing 'info' event for Stream output.
+ [#367](https://github.com/lovell/sharp/issues/367)
+ [@salzhrani](https://github.com/salzhrani)
+
+* Ensure output image EXIF Orientation values are within 1-8 range.
+ [#385](https://github.com/lovell/sharp/pull/385)
+ [@jtobinisaniceguy](https://github.com/jtobinisaniceguy)
+
+* Ensure ratios are not swapped when rotating 90/270 and ignoring aspect.
+ [#387](https://github.com/lovell/sharp/issues/387)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Remove deprecated style of calling extract API. Breaks calls using positional arguments.
+ [#276](https://github.com/lovell/sharp/issues/276)
diff --git a/docs/src/content/docs/changelog/v0.14.1.md b/docs/src/content/docs/changelog/v0.14.1.md
new file mode 100644
index 000000000..85e88c8b1
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.14.1.md
@@ -0,0 +1,26 @@
+---
+title: v0.14.1 - 16th April 2016
+slug: changelog/v0.14.1
+---
+
+* Allow removal of limitation on input pixel count via limitInputPixels. Use with care.
+ [#250](https://github.com/lovell/sharp/issues/250)
+ [#316](https://github.com/lovell/sharp/pull/316)
+ [@anandthakker](https://github.com/anandthakker)
+ [@kentongray](https://github.com/kentongray)
+
+* Use final output image for metadata passed to callback.
+ [#399](https://github.com/lovell/sharp/pull/399)
+ [@salzhrani](https://github.com/salzhrani)
+
+* Add support for writing tiled images to a zip container.
+ [#402](https://github.com/lovell/sharp/pull/402)
+ [@felixbuenemann](https://github.com/felixbuenemann)
+
+* Allow use of embed with 1 and 2 channel images.
+ [#411](https://github.com/lovell/sharp/issues/411)
+ [@janaz](https://github.com/janaz)
+
+* Improve Electron compatibility by allowing node-gyp rebuilds without npm.
+ [#412](https://github.com/lovell/sharp/issues/412)
+ [@nouh](https://github.com/nouh)
diff --git a/docs/src/content/docs/changelog/v0.15.0.md b/docs/src/content/docs/changelog/v0.15.0.md
new file mode 100644
index 000000000..ed7807f98
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.15.0.md
@@ -0,0 +1,20 @@
+---
+title: v0.15.0 - 21st May 2016
+slug: changelog/v0.15.0
+---
+
+* Use libvips' new Lanczos 3 kernel as default for image reduction.
+ Deprecate interpolateWith method, now provided as a resize option.
+ [#310](https://github.com/lovell/sharp/issues/310)
+ [@jcupitt](https://github.com/jcupitt)
+
+* Take advantage of libvips v8.3 features.
+ Add support for libvips' new GIF and SVG loaders.
+ Pre-built binaries now include giflib and librsvg, exclude *magick.
+ Use shrink-on-load for WebP input.
+ Break existing sharpen API to accept sigma and improve precision.
+ [#369](https://github.com/lovell/sharp/issues/369)
+
+* Remove unnecessary (un)premultiply operations when not resizing/compositing.
+ [#413](https://github.com/lovell/sharp/issues/413)
+ [@jardakotesovec](https://github.com/jardakotesovec)
diff --git a/docs/src/content/docs/changelog/v0.15.1.md b/docs/src/content/docs/changelog/v0.15.1.md
new file mode 100644
index 000000000..4cfdfba7d
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.15.1.md
@@ -0,0 +1,68 @@
+---
+title: v0.15.1 - 12th July 2016
+slug: changelog/v0.15.1
+---
+
+* Concat Stream-based input in single operation for ~+3% perf and less GC.
+ [#429](https://github.com/lovell/sharp/issues/429)
+ [@papandreou](https://github.com/papandreou)
+
+* Add alpha channel, if required, before extend operation.
+ [#439](https://github.com/lovell/sharp/pull/439)
+ [@frulo](https://github.com/frulo)
+
+* Allow overlay image to be repeated across entire image via tile option.
+ [#443](https://github.com/lovell/sharp/pull/443)
+ [@lemnisk8](https://github.com/lemnisk8)
+
+* Add cutout option to overlayWith feature, applies only the alpha channel of the overlay image.
+ [#448](https://github.com/lovell/sharp/pull/448)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Ensure scaling factors are calculated independently to prevent rounding errors.
+ [#452](https://github.com/lovell/sharp/issues/452)
+ [@puzrin](https://github.com/puzrin)
+
+* Add --sharp-cxx11 flag to compile with gcc's new C++11 ABI.
+ [#456](https://github.com/lovell/sharp/pull/456)
+ [@kapouer](https://github.com/kapouer)
+
+* Add top/left offset support to overlayWith operation.
+ [#473](https://github.com/lovell/sharp/pull/473)
+ [@rnanwani](https://github.com/rnanwani)
+
+* Add convolve operation for kernel-based convolution.
+ [#479](https://github.com/lovell/sharp/pull/479)
+ [@mhirsch](https://github.com/mhirsch)
+
+* Add greyscale option to threshold operation for colourspace conversion control.
+ [#480](https://github.com/lovell/sharp/pull/480)
+ [@mhirsch](https://github.com/mhirsch)
+
+* Ensure ICC profiles are licenced for distribution.
+ [#486](https://github.com/lovell/sharp/issues/486)
+ [@kapouer](https://github.com/kapouer)
+
+* Allow images with an alpha channel to work with LAB-colourspace based sharpen.
+ [#490](https://github.com/lovell/sharp/issues/490)
+ [@jwagner](https://github.com/jwagner)
+
+* Add trim operation to remove "boring" edges.
+ [#492](https://github.com/lovell/sharp/pull/492)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Add bandbool feature for channel-wise boolean operations.
+ [#496](https://github.com/lovell/sharp/pull/496)
+ [@mhirsch](https://github.com/mhirsch)
+
+* Add extractChannel operation to extract a channel from an image.
+ [#497](https://github.com/lovell/sharp/pull/497)
+ [@mhirsch](https://github.com/mhirsch)
+
+* Add ability to read and write native libvips .v files.
+ [#500](https://github.com/lovell/sharp/pull/500)
+ [@mhirsch](https://github.com/mhirsch)
+
+* Add boolean feature for bitwise image operations.
+ [#501](https://github.com/lovell/sharp/pull/501)
+ [@mhirsch](https://github.com/mhirsch)
diff --git a/docs/src/content/docs/changelog/v0.16.0.md b/docs/src/content/docs/changelog/v0.16.0.md
new file mode 100644
index 000000000..b6af330fd
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.16.0.md
@@ -0,0 +1,42 @@
+---
+title: v0.16.0 - 18th August 2016
+slug: changelog/v0.16.0
+---
+
+* Add pre-compiled libvips for OS X, ARMv7 and ARMv8.
+ [#312](https://github.com/lovell/sharp/issues/312)
+
+* Ensure boolean, bandbool, extractChannel ops occur before sRGB conversion.
+ [#504](https://github.com/lovell/sharp/pull/504)
+ [@mhirsch](https://github.com/mhirsch)
+
+* Recalculate factors after WebP shrink-on-load to avoid round-to-zero errors.
+ [#508](https://github.com/lovell/sharp/issues/508)
+ [@asilvas](https://github.com/asilvas)
+
+* Prevent boolean errors during extract operation.
+ [#511](https://github.com/lovell/sharp/pull/511)
+ [@mhirsch](https://github.com/mhirsch)
+
+* Add joinChannel and toColourspace/toColorspace operations.
+ [#513](https://github.com/lovell/sharp/pull/513)
+ [@mhirsch](https://github.com/mhirsch)
+
+* Add support for raw pixel data with boolean and withOverlay operations.
+ [#516](https://github.com/lovell/sharp/pull/516)
+ [@mhirsch](https://github.com/mhirsch)
+
+* Prevent bandbool creating a single channel sRGB image.
+ [#519](https://github.com/lovell/sharp/pull/519)
+ [@mhirsch](https://github.com/mhirsch)
+
+* Ensure ICC profiles are removed from PNG output unless withMetadata used.
+ [#521](https://github.com/lovell/sharp/issues/521)
+ [@ChrisPinewood](https://github.com/ChrisPinewood)
+
+* Add alpha channels, if missing, to overlayWith images.
+ [#540](https://github.com/lovell/sharp/pull/540)
+ [@cmtt](https://github.com/cmtt)
+
+* Remove deprecated interpolateWith method - use resize(w, h, { interpolator: ... })
+ [#310](https://github.com/lovell/sharp/issues/310)
diff --git a/docs/src/content/docs/changelog/v0.16.1.md b/docs/src/content/docs/changelog/v0.16.1.md
new file mode 100644
index 000000000..c49d28981
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.16.1.md
@@ -0,0 +1,21 @@
+---
+title: v0.16.1 - 13th October 2016
+slug: changelog/v0.16.1
+---
+
+* C++11 ABI version is now auto-detected, remove sharp-cxx11 installation flag.
+
+* Add experimental 'attention' crop strategy.
+ [#295](https://github.com/lovell/sharp/issues/295)
+
+* Include .node extension for Meteor's require() implementation.
+ [#537](https://github.com/lovell/sharp/issues/537)
+ [@isjackwild](https://github.com/isjackwild)
+
+* Ensure convolution kernel scale is clamped to a minimum value of 1.
+ [#561](https://github.com/lovell/sharp/issues/561)
+ [@abagshaw](https://github.com/abagshaw)
+
+* Correct calculation of y-axis placement when overlaying image at a fixed point.
+ [#566](https://github.com/lovell/sharp/issues/566)
+ [@Nateowami](https://github.com/Nateowami)
diff --git a/docs/src/content/docs/changelog/v0.16.2.md b/docs/src/content/docs/changelog/v0.16.2.md
new file mode 100644
index 000000000..8c3976c64
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.16.2.md
@@ -0,0 +1,8 @@
+---
+title: v0.16.2 - 22nd October 2016
+slug: changelog/v0.16.2
+---
+
+* Restrict readelf usage to Linux only when detecting global libvips version.
+ [#602](https://github.com/lovell/sharp/issues/602)
+ [@caoko](https://github.com/caoko)
diff --git a/docs/src/content/docs/changelog/v0.17.0.md b/docs/src/content/docs/changelog/v0.17.0.md
new file mode 100644
index 000000000..4ec1f1856
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.17.0.md
@@ -0,0 +1,39 @@
+---
+title: v0.17.0 - 11th December 2016
+slug: changelog/v0.17.0
+---
+
+* Drop support for versions of Node prior to v4.
+
+* Deprecate the following output format "option" functions:
+ quality, progressive, compressionLevel, withoutAdaptiveFiltering,
+ withoutChromaSubsampling, trellisQuantisation, trellisQuantization,
+ overshootDeringing, optimiseScans and optimizeScans.
+ Access to these is now via output format functions, for example `quality(n)`
+ is now `jpeg({quality: n})` and/or `webp({quality: n})`.
+
+* Autoconvert GIF and SVG input to PNG output if no other format is specified.
+
+* Expose libvips' "centre" resize option to mimic \*magick's +0.5px convention.
+ [#568](https://github.com/lovell/sharp/issues/568)
+
+* Ensure support for embedded base64 PNG and JPEG images within an SVG.
+ [#601](https://github.com/lovell/sharp/issues/601)
+ [@dynamite-ready](https://github.com/dynamite-ready)
+
+* Ensure premultiply operation occurs before box filter shrink.
+ [#605](https://github.com/lovell/sharp/issues/605)
+ [@CmdrShepardsPie](https://github.com/CmdrShepardsPie)
+ [@teroparvinen](https://github.com/teroparvinen)
+
+* Add support for PNG and WebP tile-based output formats (in addition to JPEG).
+ [#622](https://github.com/lovell/sharp/pull/622)
+ [@ppaskaris](https://github.com/ppaskaris)
+
+* Allow use of extend with greyscale input.
+ [#623](https://github.com/lovell/sharp/pull/623)
+ [@ppaskaris](https://github.com/ppaskaris)
+
+* Allow non-RGB input to embed/extend onto background with an alpha channel.
+ [#646](https://github.com/lovell/sharp/issues/646)
+ [@DaGaMs](https://github.com/DaGaMs)
diff --git a/docs/src/content/docs/changelog/v0.17.1.md b/docs/src/content/docs/changelog/v0.17.1.md
new file mode 100644
index 000000000..28cf12167
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.17.1.md
@@ -0,0 +1,15 @@
+---
+title: v0.17.1 - 15th January 2017
+slug: changelog/v0.17.1
+---
+
+* Improve error messages for invalid parameters.
+ [@spikeon](https://github.com/spikeon)
+ [#644](https://github.com/lovell/sharp/pull/644)
+
+* Simplify expression for finding vips-cpp libdir.
+ [#656](https://github.com/lovell/sharp/pull/656)
+
+* Allow HTTPS-over-HTTP proxy when downloading pre-compiled dependencies.
+ [@wangzhiwei1888](https://github.com/wangzhiwei1888)
+ [#679](https://github.com/lovell/sharp/issues/679)
diff --git a/docs/src/content/docs/changelog/v0.17.2.md b/docs/src/content/docs/changelog/v0.17.2.md
new file mode 100644
index 000000000..02859307e
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.17.2.md
@@ -0,0 +1,12 @@
+---
+title: v0.17.2 - 11th February 2017
+slug: changelog/v0.17.2
+---
+
+* Ensure Readable side of Stream can start flowing after Writable side has finished.
+ [#671](https://github.com/lovell/sharp/issues/671)
+ [@danhaller](https://github.com/danhaller)
+
+* Expose WebP alpha quality, lossless and near-lossless output options.
+ [#685](https://github.com/lovell/sharp/pull/685)
+ [@rnanwani](https://github.com/rnanwani)
diff --git a/docs/src/content/docs/changelog/v0.17.3.md b/docs/src/content/docs/changelog/v0.17.3.md
new file mode 100644
index 000000000..0bc48d942
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.17.3.md
@@ -0,0 +1,20 @@
+---
+title: v0.17.3 - 1st April 2017
+slug: changelog/v0.17.3
+---
+
+* Allow toBuffer to optionally resolve a Promise with both info and data.
+ [#143](https://github.com/lovell/sharp/issues/143)
+ [@salzhrani](https://github.com/salzhrani)
+
+* Create blank image of given width, height, channels and background.
+ [#470](https://github.com/lovell/sharp/issues/470)
+ [@pjarts](https://github.com/pjarts)
+
+* Add support for the "nearest" kernel for image reductions.
+ [#732](https://github.com/lovell/sharp/pull/732)
+ [@alice0meta](https://github.com/alice0meta)
+
+* Add support for TIFF compression and predictor options.
+ [#738](https://github.com/lovell/sharp/pull/738)
+ [@kristojorg](https://github.com/kristojorg)
diff --git a/docs/src/content/docs/changelog/v0.18.0.md b/docs/src/content/docs/changelog/v0.18.0.md
new file mode 100644
index 000000000..d8afbdd04
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.18.0.md
@@ -0,0 +1,60 @@
+---
+title: v0.18.0 - 30th May 2017
+slug: changelog/v0.18.0
+---
+
+* Remove the previously-deprecated output format "option" functions:
+ quality, progressive, compressionLevel, withoutAdaptiveFiltering,
+ withoutChromaSubsampling, trellisQuantisation, trellisQuantization,
+ overshootDeringing, optimiseScans and optimizeScans.
+
+* Ensure maximum output dimensions are based on the format to be used.
+ [#176](https://github.com/lovell/sharp/issues/176)
+ [@stephanebachelier](https://github.com/stephanebachelier)
+
+* Avoid costly (un)premultiply when using overlayWith without alpha channel.
+ [#573](https://github.com/lovell/sharp/issues/573)
+ [@strarsis](https://github.com/strarsis)
+
+* Include pixel depth (e.g. "uchar") when reading metadata.
+ [#577](https://github.com/lovell/sharp/issues/577)
+ [@moedusa](https://github.com/moedusa)
+
+* Add support for Buffer and Stream-based TIFF output.
+ [#587](https://github.com/lovell/sharp/issues/587)
+ [@strarsis](https://github.com/strarsis)
+
+* Expose warnings from libvips via NODE_DEBUG=sharp environment variable.
+ [#607](https://github.com/lovell/sharp/issues/607)
+ [@puzrin](https://github.com/puzrin)
+
+* Switch to the libvips implementation of "attention" and "entropy" crop strategies.
+ [#727](https://github.com/lovell/sharp/issues/727)
+
+* Improve performance and accuracy of nearest neighbour integral upsampling.
+ [#752](https://github.com/lovell/sharp/issues/752)
+ [@MrIbby](https://github.com/MrIbby)
+
+* Constructor single argument API: allow plain object, reject null/undefined.
+ [#768](https://github.com/lovell/sharp/issues/768)
+ [@kub1x](https://github.com/kub1x)
+
+* Ensure ARM64 pre-built binaries use correct C++11 ABI version.
+ [#772](https://github.com/lovell/sharp/issues/772)
+ [@ajiratech2](https://github.com/ajiratech2)
+
+* Prevent aliasing by using dynamic values for shrink(-on-load).
+ [#781](https://github.com/lovell/sharp/issues/781)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Expose libvips' "squash" parameter to enable 1-bit TIFF output.
+ [#783](https://github.com/lovell/sharp/pull/783)
+ [@YvesBos](https://github.com/YvesBos)
+
+* Add support for rotation using any multiple of +/-90 degrees.
+ [#791](https://github.com/lovell/sharp/pull/791)
+ [@ncoden](https://github.com/ncoden)
+
+* Add "jpg" alias to toFormat as shortened form of "jpeg".
+ [#814](https://github.com/lovell/sharp/pull/814)
+ [@jingsam](https://github.com/jingsam)
diff --git a/docs/src/content/docs/changelog/v0.18.1.md b/docs/src/content/docs/changelog/v0.18.1.md
new file mode 100644
index 000000000..3121a9cf3
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.18.1.md
@@ -0,0 +1,8 @@
+---
+title: v0.18.1 - 30th May 2017
+slug: changelog/v0.18.1
+---
+
+* Remove regression from #781 that could cause incorrect shrink calculation.
+ [#831](https://github.com/lovell/sharp/issues/831)
+ [@suprMax](https://github.com/suprMax)
diff --git a/docs/src/content/docs/changelog/v0.18.2.md b/docs/src/content/docs/changelog/v0.18.2.md
new file mode 100644
index 000000000..2eabf8374
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.18.2.md
@@ -0,0 +1,19 @@
+---
+title: v0.18.2 - 1st July 2017
+slug: changelog/v0.18.2
+---
+
+* Expose libvips' xres and yres properties for TIFF output.
+ [#828](https://github.com/lovell/sharp/pull/828)
+ [@YvesBos](https://github.com/YvesBos)
+
+* Ensure flip and flop operations work with auto-rotate.
+ [#837](https://github.com/lovell/sharp/issues/837)
+ [@rexxars](https://github.com/rexxars)
+
+* Allow binary download URL override via SHARP_DIST_BASE_URL env variable.
+ [#841](https://github.com/lovell/sharp/issues/841)
+
+* Add support for Solus Linux.
+ [#857](https://github.com/lovell/sharp/pull/857)
+ [@ekremkaraca](https://github.com/ekremkaraca)
diff --git a/docs/src/content/docs/changelog/v0.18.3.md b/docs/src/content/docs/changelog/v0.18.3.md
new file mode 100644
index 000000000..ea66e8112
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.18.3.md
@@ -0,0 +1,12 @@
+---
+title: v0.18.3 - 13th September 2017
+slug: changelog/v0.18.3
+---
+
+* Skip shrink-on-load when trimming.
+ [#888](https://github.com/lovell/sharp/pull/888)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Migrate from got to simple-get for basic auth support.
+ [#945](https://github.com/lovell/sharp/pull/945)
+ [@pbomb](https://github.com/pbomb)
diff --git a/docs/src/content/docs/changelog/v0.18.4.md b/docs/src/content/docs/changelog/v0.18.4.md
new file mode 100644
index 000000000..002e06c26
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.18.4.md
@@ -0,0 +1,8 @@
+---
+title: v0.18.4 - 18th September 2017
+slug: changelog/v0.18.4
+---
+
+* Ensure input Buffer really is marked as Persistent, prevents mark-sweep GC.
+ [#950](https://github.com/lovell/sharp/issues/950)
+ [@lfdoherty](https://github.com/lfdoherty)
diff --git a/docs/src/content/docs/changelog/v0.19.0.md b/docs/src/content/docs/changelog/v0.19.0.md
new file mode 100644
index 000000000..d9ecfefcb
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.19.0.md
@@ -0,0 +1,46 @@
+---
+title: v0.19.0 - 11th January 2018
+slug: changelog/v0.19.0
+---
+
+* Expose offset coordinates of strategy-based crop.
+ [#868](https://github.com/lovell/sharp/issues/868)
+ [@mirohristov-com](https://github.com/mirohristov-com)
+
+* PNG output now defaults to adaptiveFiltering=false, compressionLevel=9
+ [#872](https://github.com/lovell/sharp/issues/872)
+ [@wmertens](https://github.com/wmertens)
+
+* Add stats feature for pixel-derived image statistics.
+ [#915](https://github.com/lovell/sharp/pull/915)
+ [@rnanwani](https://github.com/rnanwani)
+
+* Add failOnError option to fail-fast on bad input image data.
+ [#976](https://github.com/lovell/sharp/pull/976)
+ [@mceachen](https://github.com/mceachen)
+
+* Resize: switch to libvips' implementation, make fastShrinkOnLoad optional, remove interpolator and centreSampling options.
+ [#977](https://github.com/lovell/sharp/pull/977)
+ [@jardakotesovec](https://github.com/jardakotesovec)
+
+* Attach finish event listener to a clone only for Stream-based input.
+ [#995](https://github.com/lovell/sharp/issues/995)
+ [@whmountains](https://github.com/whmountains)
+
+* Add tilecache before smartcrop to avoid over-computation of previous operations.
+ [#1028](https://github.com/lovell/sharp/issues/1028)
+ [@coffeebite](https://github.com/coffeebite)
+
+* Prevent toFile extension taking precedence over requested format.
+ [#1037](https://github.com/lovell/sharp/issues/1037)
+ [@tomgallagher](https://github.com/tomgallagher)
+
+* Add support for gravity option to existing embed feature.
+ [#1038](https://github.com/lovell/sharp/pull/1038)
+ [@AzureByte](https://github.com/AzureByte)
+
+* Expose IPTC and XMP metadata when available.
+ [#1079](https://github.com/lovell/sharp/pull/1079)
+ [@oaleynik](https://github.com/oaleynik)
+
+* TIFF output: switch default predictor from 'none' to 'horizontal' to match libvips' behaviour.
diff --git a/docs/src/content/docs/changelog/v0.19.1.md b/docs/src/content/docs/changelog/v0.19.1.md
new file mode 100644
index 000000000..deeea20d1
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.19.1.md
@@ -0,0 +1,16 @@
+---
+title: v0.19.1 - 24th February 2018
+slug: changelog/v0.19.1
+---
+
+* Expose libvips' linear transform feature.
+ [#1024](https://github.com/lovell/sharp/pull/1024)
+ [@3epnm](https://github.com/3epnm)
+
+* Expose angle option for tile-based output.
+ [#1121](https://github.com/lovell/sharp/pull/1121)
+ [@BiancoA](https://github.com/BiancoA)
+
+* Prevent crop operation when image already at or below target dimensions.
+ [#1134](https://github.com/lovell/sharp/issues/1134)
+ [@pieh](https://github.com/pieh)
diff --git a/docs/src/content/docs/changelog/v0.20.0.md b/docs/src/content/docs/changelog/v0.20.0.md
new file mode 100644
index 000000000..1f0bf56a2
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.20.0.md
@@ -0,0 +1,7 @@
+---
+title: v0.20.0 - 5th March 2018
+slug: changelog/v0.20.0
+---
+
+* Add support for prebuilt sharp binaries on common platforms.
+ [#186](https://github.com/lovell/sharp/issues/186)
diff --git a/docs/src/content/docs/changelog/v0.20.1.md b/docs/src/content/docs/changelog/v0.20.1.md
new file mode 100644
index 000000000..f4af4314c
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.20.1.md
@@ -0,0 +1,15 @@
+---
+title: v0.20.1 - 17th March 2018
+slug: changelog/v0.20.1
+---
+
+* Improve installation experience when a globally-installed libvips below the minimum required version is found.
+ [#1148](https://github.com/lovell/sharp/issues/1148)
+
+* Prevent smartcrop error when cumulative rounding is below target size.
+ [#1154](https://github.com/lovell/sharp/issues/1154)
+ [@ralrom](https://github.com/ralrom)
+
+* Expose libvips' median filter operation.
+ [#1161](https://github.com/lovell/sharp/pull/1161)
+ [@BiancoA](https://github.com/BiancoA)
diff --git a/docs/src/content/docs/changelog/v0.20.2.md b/docs/src/content/docs/changelog/v0.20.2.md
new file mode 100644
index 000000000..202d5c339
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.20.2.md
@@ -0,0 +1,20 @@
+---
+title: v0.20.2 - 28th April 2018
+slug: changelog/v0.20.2
+---
+
+* Add tint operation to set image chroma.
+ [#825](https://github.com/lovell/sharp/pull/825)
+ [@rikh42](https://github.com/rikh42)
+
+* Add environment variable to ignore globally-installed libvips.
+ [#1165](https://github.com/lovell/sharp/pull/1165)
+ [@oncletom](https://github.com/oncletom)
+
+* Add support for page selection with multi-page input (GIF/TIFF).
+ [#1204](https://github.com/lovell/sharp/pull/1204)
+ [@woolite64](https://github.com/woolite64)
+
+* Add support for Group4 (CCITTFAX4) compression with TIFF output.
+ [#1208](https://github.com/lovell/sharp/pull/1208)
+ [@woolite64](https://github.com/woolite64)
diff --git a/docs/src/content/docs/changelog/v0.20.3.md b/docs/src/content/docs/changelog/v0.20.3.md
new file mode 100644
index 000000000..b00c64910
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.20.3.md
@@ -0,0 +1,8 @@
+---
+title: v0.20.3 - 29th May 2018
+slug: changelog/v0.20.3
+---
+
+* Fix tint operation by ensuring LAB interpretation and allowing negative values.
+ [#1235](https://github.com/lovell/sharp/issues/1235)
+ [@wezside](https://github.com/wezside)
diff --git a/docs/src/content/docs/changelog/v0.20.4.md b/docs/src/content/docs/changelog/v0.20.4.md
new file mode 100644
index 000000000..a9580dea3
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.20.4.md
@@ -0,0 +1,12 @@
+---
+title: v0.20.4 - 20th June 2018
+slug: changelog/v0.20.4
+---
+
+* Prevent possible rounding error when using shrink-on-load and 90/270 degree rotation.
+ [#1241](https://github.com/lovell/sharp/issues/1241)
+ [@anahit42](https://github.com/anahit42)
+
+* Ensure extractChannel sets correct single-channel colour space interpretation.
+ [#1257](https://github.com/lovell/sharp/issues/1257)
+ [@jeremychone](https://github.com/jeremychone)
diff --git a/docs/src/content/docs/changelog/v0.20.5.md b/docs/src/content/docs/changelog/v0.20.5.md
new file mode 100644
index 000000000..07f166149
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.20.5.md
@@ -0,0 +1,8 @@
+---
+title: v0.20.5 - 27th June 2018
+slug: changelog/v0.20.5
+---
+
+* Expose libjpeg optimize_coding flag.
+ [#1265](https://github.com/lovell/sharp/pull/1265)
+ [@tomlokhorst](https://github.com/tomlokhorst)
diff --git a/docs/src/content/docs/changelog/v0.20.6.md b/docs/src/content/docs/changelog/v0.20.6.md
new file mode 100644
index 000000000..284a67a27
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.20.6.md
@@ -0,0 +1,33 @@
+---
+title: v0.20.6 - 20th August 2018
+slug: changelog/v0.20.6
+---
+
+* Add removeAlpha operation to remove alpha channel, if any.
+ [#1248](https://github.com/lovell/sharp/issues/1248)
+
+* Expose mozjpeg quant_table flag.
+ [#1285](https://github.com/lovell/sharp/pull/1285)
+ [@rexxars](https://github.com/rexxars)
+
+* Allow full WebP alphaQuality range of 0-100.
+ [#1290](https://github.com/lovell/sharp/pull/1290)
+ [@sylvaindumont](https://github.com/sylvaindumont)
+
+* Cache libvips binaries to reduce re-install time.
+ [#1301](https://github.com/lovell/sharp/issues/1301)
+
+* Ensure vendor platform mismatch throws error at install time.
+ [#1303](https://github.com/lovell/sharp/issues/1303)
+
+* Improve install time error messages for FreeBSD users.
+ [#1310](https://github.com/lovell/sharp/issues/1310)
+
+* Ensure extractChannel works with 16-bit images.
+ [#1330](https://github.com/lovell/sharp/issues/1330)
+
+* Expose depth option for tile-based output.
+ [#1342](https://github.com/lovell/sharp/pull/1342)
+ [@alundavies](https://github.com/alundavies)
+
+* Add experimental entropy field to stats response.
diff --git a/docs/src/content/docs/changelog/v0.20.7.md b/docs/src/content/docs/changelog/v0.20.7.md
new file mode 100644
index 000000000..e9503a29d
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.20.7.md
@@ -0,0 +1,7 @@
+---
+title: v0.20.7 - 21st August 2018
+slug: changelog/v0.20.7
+---
+
+* Use copy+unlink if rename operation fails during installation.
+ [#1345](https://github.com/lovell/sharp/issues/1345)
diff --git a/docs/src/content/docs/changelog/v0.20.8.md b/docs/src/content/docs/changelog/v0.20.8.md
new file mode 100644
index 000000000..8ab9a062a
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.20.8.md
@@ -0,0 +1,12 @@
+---
+title: v0.20.8 - 5th September 2018
+slug: changelog/v0.20.8
+---
+
+* Avoid race conditions when creating directories during installation.
+ [#1358](https://github.com/lovell/sharp/pull/1358)
+ [@ajhool](https://github.com/ajhool)
+
+* Accept floating point values for input density parameter.
+ [#1362](https://github.com/lovell/sharp/pull/1362)
+ [@aeirola](https://github.com/aeirola)
diff --git a/docs/src/content/docs/changelog/v0.21.0.md b/docs/src/content/docs/changelog/v0.21.0.md
new file mode 100644
index 000000000..762cc65a4
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.21.0.md
@@ -0,0 +1,39 @@
+---
+title: v0.21.0 - 4th October 2018
+slug: changelog/v0.21.0
+---
+
+* Deprecate the following resize-related functions:
+ `crop`, `embed`, `ignoreAspectRatio`, `max`, `min` and `withoutEnlargement`.
+ Access to these is now via options passed to the `resize` function.
+ For example:
+ `embed('north')` is now `resize(width, height, { fit: 'contain', position: 'north' })`,
+ `crop('attention')` is now `resize(width, height, { fit: 'cover', position: 'attention' })`,
+ `max().withoutEnlargement()` is now `resize(width, height, { fit: 'inside', withoutEnlargement: true })`.
+ [#1135](https://github.com/lovell/sharp/issues/1135)
+
+* Deprecate the `background` function.
+ Per-operation `background` options added to `resize`, `extend` and `flatten` operations.
+ [#1392](https://github.com/lovell/sharp/issues/1392)
+
+* Add `size` to `metadata` response (Stream and Buffer input only).
+ [#695](https://github.com/lovell/sharp/issues/695)
+
+* Switch from custom trim operation to `vips_find_trim`.
+ [#914](https://github.com/lovell/sharp/issues/914)
+
+* Add `chromaSubsampling` and `isProgressive` properties to `metadata` response.
+ [#1186](https://github.com/lovell/sharp/issues/1186)
+
+* Drop Node 4 support.
+ [#1212](https://github.com/lovell/sharp/issues/1212)
+
+* Enable SIMD convolution by default.
+ [#1213](https://github.com/lovell/sharp/issues/1213)
+
+* Add experimental prebuilt binaries for musl-based Linux.
+ [#1379](https://github.com/lovell/sharp/issues/1379)
+
+* Add support for arbitrary rotation angle via vips_rotate.
+ [#1385](https://github.com/lovell/sharp/pull/1385)
+ [@freezy](https://github.com/freezy)
diff --git a/docs/src/content/docs/changelog/v0.21.1.md b/docs/src/content/docs/changelog/v0.21.1.md
new file mode 100644
index 000000000..bb685ef2b
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.21.1.md
@@ -0,0 +1,31 @@
+---
+title: v0.21.1 - 7th December 2018
+slug: changelog/v0.21.1
+---
+
+* Install: support `sharp_dist_base_url` npm config, like existing `SHARP_DIST_BASE_URL`.
+ [#1422](https://github.com/lovell/sharp/pull/1422)
+ [@SethWen](https://github.com/SethWen)
+
+* Ensure `channel` metadata is correct for raw, greyscale output.
+ [#1425](https://github.com/lovell/sharp/issues/1425)
+
+* Add support for the "mitchell" kernel for image reductions.
+ [#1438](https://github.com/lovell/sharp/pull/1438)
+ [@Daiz](https://github.com/Daiz)
+
+* Allow separate parameters for gamma encoding and decoding.
+ [#1439](https://github.com/lovell/sharp/pull/1439)
+ [@Daiz](https://github.com/Daiz)
+
+* Build prototype with `Object.assign` to allow minification.
+ [#1475](https://github.com/lovell/sharp/pull/1475)
+ [@jaubourg](https://github.com/jaubourg)
+
+* Expose libvips' recombination matrix operation.
+ [#1477](https://github.com/lovell/sharp/pull/1477)
+ [@fromkeith](https://github.com/fromkeith)
+
+* Expose libvips' pyramid/tile options for TIFF output.
+ [#1483](https://github.com/lovell/sharp/pull/1483)
+ [@mbklein](https://github.com/mbklein)
diff --git a/docs/src/content/docs/changelog/v0.21.2.md b/docs/src/content/docs/changelog/v0.21.2.md
new file mode 100644
index 000000000..be7f6758d
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.21.2.md
@@ -0,0 +1,27 @@
+---
+title: v0.21.2 - 13th January 2019
+slug: changelog/v0.21.2
+---
+
+* Ensure all metadata is removed from PNG output unless `withMetadata` used.
+
+* Ensure shortest edge is at least one pixel after resizing.
+ [#1003](https://github.com/lovell/sharp/issues/1003)
+
+* Add `ensureAlpha` operation to add an alpha channel, if missing.
+ [#1153](https://github.com/lovell/sharp/issues/1153)
+
+* Expose `pages` and `pageHeight` metadata for multi-page input images.
+ [#1205](https://github.com/lovell/sharp/issues/1205)
+
+* Expose PNG output options requiring libimagequant.
+ [#1484](https://github.com/lovell/sharp/issues/1484)
+
+* Expose underlying error message for invalid input.
+ [#1505](https://github.com/lovell/sharp/issues/1505)
+
+* Prevent mutatation of options passed to `jpeg`.
+ [#1516](https://github.com/lovell/sharp/issues/1516)
+
+* Ensure forced output format applied correctly when output chaining.
+ [#1528](https://github.com/lovell/sharp/issues/1528)
diff --git a/docs/src/content/docs/changelog/v0.21.3.md b/docs/src/content/docs/changelog/v0.21.3.md
new file mode 100644
index 000000000..1cde28c63
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.21.3.md
@@ -0,0 +1,9 @@
+---
+title: v0.21.3 - 19th January 2019
+slug: changelog/v0.21.3
+---
+
+* Input image decoding now fails fast, set `failOnError` to change this behaviour.
+
+* Failed filesystem-based input now separates missing file and invalid format errors.
+ [#1542](https://github.com/lovell/sharp/issues/1542)
diff --git a/docs/src/content/docs/changelog/v0.22.0.md b/docs/src/content/docs/changelog/v0.22.0.md
new file mode 100644
index 000000000..797c743bc
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.22.0.md
@@ -0,0 +1,20 @@
+---
+title: v0.22.0 - 18th March 2019
+slug: changelog/v0.22.0
+---
+
+* Remove functions previously deprecated in v0.21.0:
+ `background`, `crop`, `embed`, `ignoreAspectRatio`, `max`, `min` and `withoutEnlargement`.
+
+* Add `composite` operation supporting multiple images and blend modes; deprecate `overlayWith`.
+ [#728](https://github.com/lovell/sharp/issues/728)
+
+* Add support for `pages` input option for multi-page input.
+ [#1566](https://github.com/lovell/sharp/issues/1566)
+
+* Allow Stream-based input of raw pixel data.
+ [#1579](https://github.com/lovell/sharp/issues/1579)
+
+* Add support for `page` input option to GIF and PDF.
+ [#1595](https://github.com/lovell/sharp/pull/1595)
+ [@ramiel](https://github.com/ramiel)
diff --git a/docs/src/content/docs/changelog/v0.22.1.md b/docs/src/content/docs/changelog/v0.22.1.md
new file mode 100644
index 000000000..cf8e3d464
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.22.1.md
@@ -0,0 +1,15 @@
+---
+title: v0.22.1 - 25th April 2019
+slug: changelog/v0.22.1
+---
+
+* Add `modulate` operation for brightness, saturation and hue.
+ [#1601](https://github.com/lovell/sharp/pull/1601)
+ [@Goues](https://github.com/Goues)
+
+* Improve help messaging should `require("sharp")` fail.
+ [#1638](https://github.com/lovell/sharp/pull/1638)
+ [@sidharthachatterjee](https://github.com/sidharthachatterjee)
+
+* Add support for Node 12.
+ [#1668](https://github.com/lovell/sharp/issues/1668)
diff --git a/docs/src/content/docs/changelog/v0.23.0.md b/docs/src/content/docs/changelog/v0.23.0.md
new file mode 100644
index 000000000..24b18827c
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.23.0.md
@@ -0,0 +1,32 @@
+---
+title: v0.23.0 - 29th July 2019
+slug: changelog/v0.23.0
+---
+
+* Remove `overlayWith` previously deprecated in v0.22.0.
+
+* Add experimental support for HEIF images. Requires libvips compiled with libheif.
+ [#1105](https://github.com/lovell/sharp/issues/1105)
+
+* Expose libwebp `smartSubsample` and `reductionEffort` options.
+ [#1545](https://github.com/lovell/sharp/issues/1545)
+
+* Add experimental support for Worker Threads.
+ [#1558](https://github.com/lovell/sharp/issues/1558)
+
+* Use libvips' built-in CMYK and sRGB profiles when required.
+ [#1619](https://github.com/lovell/sharp/issues/1619)
+
+* Drop support for Node.js versions 6 and 11.
+ [#1674](https://github.com/lovell/sharp/issues/1674)
+
+* Expose `skipBlanks` option for tile-based output.
+ [#1687](https://github.com/lovell/sharp/pull/1687)
+ [@RaboliotTheGrey](https://github.com/RaboliotTheGrey)
+
+* Allow use of `failOnError` option with Stream-based input.
+ [#1691](https://github.com/lovell/sharp/issues/1691)
+
+* Fix rotate/extract ordering for non-90 angles.
+ [#1755](https://github.com/lovell/sharp/pull/1755)
+ [@iovdin](https://github.com/iovdin)
diff --git a/docs/src/content/docs/changelog/v0.23.1.md b/docs/src/content/docs/changelog/v0.23.1.md
new file mode 100644
index 000000000..c180d9952
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.23.1.md
@@ -0,0 +1,24 @@
+---
+title: v0.23.1 - 26th September 2019
+slug: changelog/v0.23.1
+---
+
+* Ensure `sharp.format.vips` is present and correct (filesystem only).
+ [#1813](https://github.com/lovell/sharp/issues/1813)
+
+* Ensure invalid `width` and `height` provided as options to `resize` throw.
+ [#1817](https://github.com/lovell/sharp/issues/1817)
+
+* Allow use of 'heic' and 'heif' identifiers with `toFormat`.
+ [#1834](https://github.com/lovell/sharp/pull/1834)
+ [@jaubourg](https://github.com/jaubourg)
+
+* Add `premultiplied` option to `composite` operation.
+ [#1835](https://github.com/lovell/sharp/pull/1835)
+ [@Andargor](https://github.com/Andargor)
+
+* Allow instance reuse with differing `toBuffer` options.
+ [#1860](https://github.com/lovell/sharp/pull/1860)
+ [@RaboliotTheGrey](https://github.com/RaboliotTheGrey)
+
+* Ensure image is at least 3x3 pixels before attempting trim operation.
diff --git a/docs/src/content/docs/changelog/v0.23.2.md b/docs/src/content/docs/changelog/v0.23.2.md
new file mode 100644
index 000000000..1eb59491d
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.23.2.md
@@ -0,0 +1,12 @@
+---
+title: v0.23.2 - 28th October 2019
+slug: changelog/v0.23.2
+---
+
+* Add `background` option to tile output operation.
+ [#1924](https://github.com/lovell/sharp/pull/1924)
+ [@neave](https://github.com/neave)
+
+* Add support for Node.js 13.
+ [#1932](https://github.com/lovell/sharp/pull/1932)
+ [@MayhemYDG](https://github.com/MayhemYDG)
diff --git a/docs/src/content/docs/changelog/v0.23.3.md b/docs/src/content/docs/changelog/v0.23.3.md
new file mode 100644
index 000000000..4c19795a5
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.23.3.md
@@ -0,0 +1,18 @@
+---
+title: v0.23.3 - 17th November 2019
+slug: changelog/v0.23.3
+---
+
+* Ensure `trim` operation supports images contained in the alpha channel.
+ [#1597](https://github.com/lovell/sharp/issues/1597)
+
+* Ensure tile `overlap` option works as expected.
+ [#1921](https://github.com/lovell/sharp/pull/1921)
+ [@rustyguts](https://github.com/rustyguts)
+
+* Allow compilation on FreeBSD and variants (broken since v0.23.0)
+ [#1952](https://github.com/lovell/sharp/pull/1952)
+ [@pouya-eghbali](https://github.com/pouya-eghbali)
+
+* Ensure `modulate` and other colour-based operations can co-exist.
+ [#1958](https://github.com/lovell/sharp/issues/1958)
diff --git a/docs/src/content/docs/changelog/v0.23.4.md b/docs/src/content/docs/changelog/v0.23.4.md
new file mode 100644
index 000000000..3d8bfed73
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.23.4.md
@@ -0,0 +1,12 @@
+---
+title: v0.23.4 - 5th December 2019
+slug: changelog/v0.23.4
+---
+
+* Handle zero-length Buffer objects when using Node.js v13.2.0+.
+
+* Expose raw TIFFTAG_PHOTOSHOP metadata.
+ [#1600](https://github.com/lovell/sharp/issues/1600)
+
+* Improve thread safety by using copy-on-write when updating metadata.
+ [#1986](https://github.com/lovell/sharp/issues/1986)
diff --git a/docs/src/content/docs/changelog/v0.24.0.md b/docs/src/content/docs/changelog/v0.24.0.md
new file mode 100644
index 000000000..378dad771
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.24.0.md
@@ -0,0 +1,28 @@
+---
+title: v0.24.0 - 16th January 2020
+slug: changelog/v0.24.0
+---
+
+* Drop support for Node.js 8.
+ [#1910](https://github.com/lovell/sharp/issues/1910)
+
+* Drop support for undefined input where options also provided.
+ [#1768](https://github.com/lovell/sharp/issues/1768)
+
+* Move `limitInputPixels` and `sequentialRead` to input options, deprecating functions of the same name.
+
+* Expose `delay` and `loop` metadata for animated images.
+ [#1905](https://github.com/lovell/sharp/issues/1905)
+
+* Ensure correct colour output for 16-bit, 2-channel PNG input with ICC profile.
+ [#2013](https://github.com/lovell/sharp/issues/2013)
+
+* Prevent use of sequentialRead for rotate operations.
+ [#2016](https://github.com/lovell/sharp/issues/2016)
+
+* Correctly bind max width and height values when using withoutEnlargement.
+ [#2024](https://github.com/lovell/sharp/pull/2024)
+ [@BrychanOdlum](https://github.com/BrychanOdlum)
+
+* Add support for input with 16-bit RGB profile.
+ [#2037](https://github.com/lovell/sharp/issues/2037)
diff --git a/docs/src/content/docs/changelog/v0.24.1.md b/docs/src/content/docs/changelog/v0.24.1.md
new file mode 100644
index 000000000..2155c2005
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.24.1.md
@@ -0,0 +1,10 @@
+---
+title: v0.24.1 - 15th February 2020
+slug: changelog/v0.24.1
+---
+
+* Prevent use of sequentialRead for EXIF-based rotate operation.
+ [#2042](https://github.com/lovell/sharp/issues/2042)
+
+* Ensure RGBA LZW TIFF returns correct channel count.
+ [#2064](https://github.com/lovell/sharp/issues/2064)
diff --git a/docs/src/content/docs/changelog/v0.25.0.md b/docs/src/content/docs/changelog/v0.25.0.md
new file mode 100644
index 000000000..b42978a98
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.25.0.md
@@ -0,0 +1,18 @@
+---
+title: v0.25.0 - 7th March 2020
+slug: changelog/v0.25.0
+---
+
+* Remove `limitInputPixels` and `sequentialRead` previously deprecated in v0.24.0.
+
+* Migrate internals to N-API.
+ [#1282](https://github.com/lovell/sharp/issues/1282)
+
+* Add support for 32-bit Windows.
+ [#2088](https://github.com/lovell/sharp/issues/2088)
+
+* Ensure correct ordering of rotate-then-trim operations.
+ [#2087](https://github.com/lovell/sharp/issues/2087)
+
+* Ensure composite accepts `limitInputPixels` and `sequentialRead` input options.
+ [#2099](https://github.com/lovell/sharp/issues/2099)
diff --git a/docs/src/content/docs/changelog/v0.25.1.md b/docs/src/content/docs/changelog/v0.25.1.md
new file mode 100644
index 000000000..af0fe39d4
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.25.1.md
@@ -0,0 +1,7 @@
+---
+title: v0.25.1 - 7th March 2020
+slug: changelog/v0.25.1
+---
+
+* Ensure prebuilt binaries are fetched based on N-API version.
+ [#2117](https://github.com/lovell/sharp/issues/2117)
diff --git a/docs/src/content/docs/changelog/v0.25.2.md b/docs/src/content/docs/changelog/v0.25.2.md
new file mode 100644
index 000000000..298db561a
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.25.2.md
@@ -0,0 +1,19 @@
+---
+title: v0.25.2 - 20th March 2020
+slug: changelog/v0.25.2
+---
+
+* Provide prebuilt binaries for Linux ARM64v8.
+
+* Add IIIF layout support to tile-based output.
+ [#2098](https://github.com/lovell/sharp/pull/2098)
+ [@edsilv](https://github.com/edsilv)
+
+* Ensure input options are consistently and correctly detected.
+ [#2118](https://github.com/lovell/sharp/issues/2118)
+
+* Ensure N-API prebuilt binaries work on RHEL7 and its derivatives.
+ [#2119](https://github.com/lovell/sharp/issues/2119)
+
+* Ensure AsyncWorker options are persisted.
+ [#2130](https://github.com/lovell/sharp/issues/2130)
diff --git a/docs/src/content/docs/changelog/v0.25.3.md b/docs/src/content/docs/changelog/v0.25.3.md
new file mode 100644
index 000000000..0a1a76038
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.25.3.md
@@ -0,0 +1,14 @@
+---
+title: v0.25.3 - 17th May 2020
+slug: changelog/v0.25.3
+---
+
+* Ensure libvips is initialised only once, improves worker thread safety.
+ [#2143](https://github.com/lovell/sharp/issues/2143)
+
+* Ensure npm platform flag is respected when copying DLLs.
+ [#2188](https://github.com/lovell/sharp/pull/2188)
+ [@dimadeveatii](https://github.com/dimadeveatii)
+
+* Allow SVG input with large inline images to be parsed.
+ [#2195](https://github.com/lovell/sharp/issues/2195)
diff --git a/docs/src/content/docs/changelog/v0.25.4.md b/docs/src/content/docs/changelog/v0.25.4.md
new file mode 100644
index 000000000..6bd4deb59
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.25.4.md
@@ -0,0 +1,25 @@
+---
+title: v0.25.4 - 12th June 2020
+slug: changelog/v0.25.4
+---
+
+* Allow libvips binary location override where version is appended.
+ [#2217](https://github.com/lovell/sharp/pull/2217)
+ [@malice00](https://github.com/malice00)
+
+* Enable PNG palette when setting quality, colours, colors or dither.
+ [#2226](https://github.com/lovell/sharp/pull/2226)
+ [@romaleev](https://github.com/romaleev)
+
+* Add `level` constructor option to use a specific level of a multi-level image.
+ Expose `levels` metadata for multi-level images.
+ [#2222](https://github.com/lovell/sharp/issues/2222)
+
+* Add support for named `alpha` channel to `extractChannel` operation.
+ [#2138](https://github.com/lovell/sharp/issues/2138)
+
+* Add experimental `sharpness` calculation to `stats()` response.
+ [#2251](https://github.com/lovell/sharp/issues/2251)
+
+* Emit `warning` event for non-critical processing problems.
+ [#2032](https://github.com/lovell/sharp/issues/2032)
diff --git a/docs/src/content/docs/changelog/v0.26.0.md b/docs/src/content/docs/changelog/v0.26.0.md
new file mode 100644
index 000000000..6fedd7e35
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.26.0.md
@@ -0,0 +1,33 @@
+---
+title: v0.26.0 - 25th August 2020
+slug: changelog/v0.26.0
+---
+
+* Prebuilt libvips binaries are now statically-linked and Brotli-compressed, requiring Node.js 10.16.0+.
+
+* TIFF output `squash` is replaced by `bitdepth` to reduce to 1, 2 or 4 bit.
+
+* JPEG output `quality` >= 90 no longer automatically sets `chromaSubsampling` to `4:4:4`.
+
+* Add most `dominant` colour to image `stats`.
+ [#640](https://github.com/lovell/sharp/issues/640)
+
+* Add support for animated GIF (requires \*magick) and WebP output.
+ [#2012](https://github.com/lovell/sharp/pull/2012)
+ [@deftomat](https://github.com/deftomat)
+
+* Add support for libvips ImageMagick v7 loaders.
+ [#2258](https://github.com/lovell/sharp/pull/2258)
+ [@vouillon](https://github.com/vouillon)
+
+* Allow multi-page input via \*magick.
+ [#2259](https://github.com/lovell/sharp/pull/2259)
+ [@vouillon](https://github.com/vouillon)
+
+* Add support to `withMetadata` for custom ICC profile.
+ [#2271](https://github.com/lovell/sharp/pull/2271)
+ [@roborourke](https://github.com/roborourke)
+
+* Ensure prebuilt binaries for ARM default to v7 when using Electron.
+ [#2292](https://github.com/lovell/sharp/pull/2292)
+ [@diegodev3](https://github.com/diegodev3)
diff --git a/docs/src/content/docs/changelog/v0.26.1.md b/docs/src/content/docs/changelog/v0.26.1.md
new file mode 100644
index 000000000..080b05da3
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.26.1.md
@@ -0,0 +1,22 @@
+---
+title: v0.26.1 - 20th September 2020
+slug: changelog/v0.26.1
+---
+
+* Ensure correct pageHeight when verifying multi-page image dimensions.
+ [#2343](https://github.com/lovell/sharp/pull/2343)
+ [@derom](https://github.com/derom)
+
+* Allow input density range up to 100000 DPI.
+ [#2348](https://github.com/lovell/sharp/pull/2348)
+ [@stefanprobst](https://github.com/stefanprobst)
+
+* Ensure animation-related properties can be set for Stream-based input.
+ [#2369](https://github.com/lovell/sharp/pull/2369)
+ [@AcrylicShrimp](https://github.com/AcrylicShrimp)
+
+* Ensure `stats` can be calculated for 1x1 input.
+ [#2372](https://github.com/lovell/sharp/issues/2372)
+
+* Ensure animated GIF output is optimised.
+ [#2376](https://github.com/lovell/sharp/issues/2376)
diff --git a/docs/src/content/docs/changelog/v0.26.2.md b/docs/src/content/docs/changelog/v0.26.2.md
new file mode 100644
index 000000000..2031300a2
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.26.2.md
@@ -0,0 +1,15 @@
+---
+title: v0.26.2 - 14th October 2020
+slug: changelog/v0.26.2
+---
+
+* Add support for EXR input. Requires libvips compiled with OpenEXR.
+ [#698](https://github.com/lovell/sharp/issues/698)
+
+* Ensure support for yarn v2.
+ [#2379](https://github.com/lovell/sharp/pull/2379)
+ [@jalovatt](https://github.com/jalovatt)
+
+* Add centre/center option to tile-based output.
+ [#2397](https://github.com/lovell/sharp/pull/2397)
+ [@beig](https://github.com/beig)
diff --git a/docs/src/content/docs/changelog/v0.26.3.md b/docs/src/content/docs/changelog/v0.26.3.md
new file mode 100644
index 000000000..a12a54480
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.26.3.md
@@ -0,0 +1,12 @@
+---
+title: v0.26.3 - 16th November 2020
+slug: changelog/v0.26.3
+---
+
+* Expose libvips' affine operation.
+ [#2336](https://github.com/lovell/sharp/pull/2336)
+ [@guillevc](https://github.com/guillevc)
+
+* Fallback to tar.gz for prebuilt libvips when Brotli not available.
+ [#2412](https://github.com/lovell/sharp/pull/2412)
+ [@ascorbic](https://github.com/ascorbic)
diff --git a/docs/src/content/docs/changelog/v0.27.0.md b/docs/src/content/docs/changelog/v0.27.0.md
new file mode 100644
index 000000000..d21378479
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.27.0.md
@@ -0,0 +1,15 @@
+---
+title: v0.27.0 - 22nd December 2020
+slug: changelog/v0.27.0
+---
+
+* Add support for AVIF to prebuilt binaries.
+
+* Remove experimental status from `heif` output, defaults are now AVIF-centric.
+
+* Allow negative top/left offsets for composite operation.
+ [#2391](https://github.com/lovell/sharp/pull/2391)
+ [@CurosMJ](https://github.com/CurosMJ)
+
+* Ensure all platforms use fontconfig for font rendering.
+ [#2399](https://github.com/lovell/sharp/issues/2399)
diff --git a/docs/src/content/docs/changelog/v0.27.1.md b/docs/src/content/docs/changelog/v0.27.1.md
new file mode 100644
index 000000000..09b24da60
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.27.1.md
@@ -0,0 +1,19 @@
+---
+title: v0.27.1 - 27th January 2021
+slug: changelog/v0.27.1
+---
+
+* Ensure TIFF is cast when using float predictor.
+ [#2502](https://github.com/lovell/sharp/pull/2502)
+ [@randyridge](https://github.com/randyridge)
+
+* Add support for Uint8Array and Uint8ClampedArray input.
+ [#2511](https://github.com/lovell/sharp/pull/2511)
+ [@leon](https://github.com/leon)
+
+* Revert: ensure all platforms use fontconfig for font rendering.
+ [#2515](https://github.com/lovell/sharp/issues/2515)
+
+* Expose libvips gaussnoise operation to allow creation of Gaussian noise.
+ [#2527](https://github.com/lovell/sharp/pull/2527)
+ [@alza54](https://github.com/alza54)
diff --git a/docs/src/content/docs/changelog/v0.27.2.md b/docs/src/content/docs/changelog/v0.27.2.md
new file mode 100644
index 000000000..b8eb9c386
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.27.2.md
@@ -0,0 +1,20 @@
+---
+title: v0.27.2 - 22nd February 2021
+slug: changelog/v0.27.2
+---
+
+* macOS: Prevent use of globally-installed ARM64 libvips with Rosetta x64 emulation.
+ [#2460](https://github.com/lovell/sharp/issues/2460)
+
+* Linux (musl): Prevent use of prebuilt linuxmusl-x64 binaries with musl >= 1.2.0.
+ [#2570](https://github.com/lovell/sharp/issues/2570)
+
+* Improve 16-bit grey+alpha support by using libvips' `has_alpha` detection.
+ [#2569](https://github.com/lovell/sharp/issues/2569)
+
+* Allow the use of non lower case extensions with `toFormat`.
+ [#2581](https://github.com/lovell/sharp/pull/2581)
+ [@florian-busch](https://github.com/florian-busch)
+
+* Allow use of `recomb` operation with single channel input.
+ [#2584](https://github.com/lovell/sharp/issues/2584)
diff --git a/docs/src/content/docs/changelog/v0.28.0.md b/docs/src/content/docs/changelog/v0.28.0.md
new file mode 100644
index 000000000..e3a72f815
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.28.0.md
@@ -0,0 +1,32 @@
+---
+title: v0.28.0 - 29th March 2021
+slug: changelog/v0.28.0
+---
+
+* Prebuilt binaries now include mozjpeg and libimagequant (BSD 2-Clause).
+
+* Prebuilt binaries limit AVIF support to the most common 8-bit depth.
+
+* Add `mozjpeg` option to `jpeg` method, sets mozjpeg defaults.
+
+* Reduce the default PNG `compressionLevel` to the more commonly used 6.
+
+* Reduce concurrency on glibc-based Linux when using the default memory allocator to help prevent fragmentation.
+
+* Default missing edge properties of extend operation to zero.
+ [#2578](https://github.com/lovell/sharp/issues/2578)
+
+* Ensure composite does not clip top and left offsets.
+ [#2594](https://github.com/lovell/sharp/pull/2594)
+ [@SHG42](https://github.com/SHG42)
+
+* Improve error handling of network failure at install time.
+ [#2608](https://github.com/lovell/sharp/pull/2608)
+ [@abradley](https://github.com/abradley)
+
+* Ensure `@id` attribute can be set for IIIF tile-based output.
+ [#2612](https://github.com/lovell/sharp/issues/2612)
+ [@edsilv](https://github.com/edsilv)
+
+* Ensure composite replicates the correct number of tiles for centred gravities.
+ [#2626](https://github.com/lovell/sharp/issues/2626)
diff --git a/docs/src/content/docs/changelog/v0.28.1.md b/docs/src/content/docs/changelog/v0.28.1.md
new file mode 100644
index 000000000..38e11a38a
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.28.1.md
@@ -0,0 +1,15 @@
+---
+title: v0.28.1 - 5th April 2021
+slug: changelog/v0.28.1
+---
+
+* Ensure all installation errors are logged with a more obvious prefix.
+
+* Allow `withMetadata` to set and update EXIF metadata.
+ [#650](https://github.com/lovell/sharp/issues/650)
+
+* Add support for OME-TIFF Sub Image File Directories (subIFD).
+ [#2557](https://github.com/lovell/sharp/issues/2557)
+
+* Allow `ensureAlpha` to set the alpha transparency level.
+ [#2634](https://github.com/lovell/sharp/issues/2634)
diff --git a/docs/src/content/docs/changelog/v0.28.2.md b/docs/src/content/docs/changelog/v0.28.2.md
new file mode 100644
index 000000000..9f067c44f
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.28.2.md
@@ -0,0 +1,26 @@
+---
+title: v0.28.2 - 10th May 2021
+slug: changelog/v0.28.2
+---
+
+* Allow `withMetadata` to set `density`.
+ [#967](https://github.com/lovell/sharp/issues/967)
+
+* Skip shrink-on-load where one dimension <4px.
+ [#2653](https://github.com/lovell/sharp/issues/2653)
+
+* Allow escaped proxy credentials.
+ [#2664](https://github.com/lovell/sharp/pull/2664)
+ [@msalettes](https://github.com/msalettes)
+
+* Add `premultiplied` flag for raw pixel data input.
+ [#2685](https://github.com/lovell/sharp/pull/2685)
+ [@mnutt](https://github.com/mnutt)
+
+* Detect empty input and throw a helpful error.
+ [#2687](https://github.com/lovell/sharp/pull/2687)
+ [@JakobJingleheimer](https://github.com/JakobJingleheimer)
+
+* Add install-time flag to skip version compatibility checks.
+ [#2692](https://github.com/lovell/sharp/pull/2692)
+ [@xemle](https://github.com/xemle)
diff --git a/docs/src/content/docs/changelog/v0.28.3.md b/docs/src/content/docs/changelog/v0.28.3.md
new file mode 100644
index 000000000..dff933269
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.28.3.md
@@ -0,0 +1,13 @@
+---
+title: v0.28.3 - 24th May 2021
+slug: changelog/v0.28.3
+---
+
+* Ensure presence of libvips, vendored or global, before invoking node-gyp.
+
+* Skip shrink-on-load for multi-page WebP.
+ [#2714](https://github.com/lovell/sharp/issues/2714)
+
+* Add contrast limiting adaptive histogram equalization (CLAHE) operator.
+ [#2726](https://github.com/lovell/sharp/pull/2726)
+ [@baparham](https://github.com/baparham)
diff --git a/docs/src/content/docs/changelog/v0.29.0.md b/docs/src/content/docs/changelog/v0.29.0.md
new file mode 100644
index 000000000..087545991
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.29.0.md
@@ -0,0 +1,35 @@
+---
+title: v0.29.0 - 17th August 2021
+slug: changelog/v0.29.0
+---
+
+* Drop support for Node.js 10, now requires Node.js >= 12.13.0.
+
+* Add `background` property to PNG and GIF image metadata.
+
+* Add `compression` property to HEIF image metadata.
+ [#2504](https://github.com/lovell/sharp/issues/2504)
+
+* AVIF encoding now defaults to `4:4:4` chroma subsampling.
+ [#2562](https://github.com/lovell/sharp/issues/2562)
+
+* Allow multiple platform-arch binaries in same `node_modules` installation tree.
+ [#2575](https://github.com/lovell/sharp/issues/2575)
+
+* Default to single-channel `b-w` space when `extractChannel` is used.
+ [#2658](https://github.com/lovell/sharp/issues/2658)
+
+* Allow installation directory to contain spaces (regression in v0.26.0).
+ [#2777](https://github.com/lovell/sharp/issues/2777)
+
+* Add `pipelineColourspace` operator to set the processing space.
+ [#2704](https://github.com/lovell/sharp/pull/2704)
+ [@Daiz](https://github.com/Daiz)
+
+* Allow bit depth to be set when using raw input and output.
+ [#2762](https://github.com/lovell/sharp/pull/2762)
+ [@mart-jansink](https://github.com/mart-jansink)
+
+* Allow `negate` to act only on non-alpha channels.
+ [#2808](https://github.com/lovell/sharp/pull/2808)
+ [@rexxars](https://github.com/rexxars)
diff --git a/docs/src/content/docs/changelog/v0.29.1.md b/docs/src/content/docs/changelog/v0.29.1.md
new file mode 100644
index 000000000..58809cbf4
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.29.1.md
@@ -0,0 +1,30 @@
+---
+title: v0.29.1 - 7th September 2021
+slug: changelog/v0.29.1
+---
+
+* Add `lightness` option to `modulate` operation.
+ [#2846](https://github.com/lovell/sharp/pull/2846)
+
+* Ensure correct PNG bitdepth is set based on number of colours.
+ [#2855](https://github.com/lovell/sharp/issues/2855)
+
+* Ensure background is always premultiplied when compositing.
+ [#2858](https://github.com/lovell/sharp/issues/2858)
+
+* Ensure images with P3 profiles retain full gamut.
+ [#2862](https://github.com/lovell/sharp/issues/2862)
+
+* Add support for libvips compiled with OpenJPEG.
+ [#2868](https://github.com/lovell/sharp/pull/2868)
+
+* Remove unsupported animation properties from AVIF output.
+ [#2870](https://github.com/lovell/sharp/issues/2870)
+
+* Resolve paths before comparing input/output filenames.
+ [#2878](https://github.com/lovell/sharp/pull/2878)
+ [@rexxars](https://github.com/rexxars)
+
+* Allow use of speed 9 (fastest) for HEIF encoding.
+ [#2879](https://github.com/lovell/sharp/pull/2879)
+ [@rexxars](https://github.com/rexxars)
diff --git a/docs/src/content/docs/changelog/v0.29.2.md b/docs/src/content/docs/changelog/v0.29.2.md
new file mode 100644
index 000000000..0628963f0
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.29.2.md
@@ -0,0 +1,22 @@
+---
+title: v0.29.2 - 21st October 2021
+slug: changelog/v0.29.2
+---
+
+* Add `timeout` function to limit processing time.
+
+* Ensure `sharp.versions` is populated from vendored libvips.
+
+* Remove animation properties from single page images.
+ [#2890](https://github.com/lovell/sharp/issues/2890)
+
+* Allow use of 'tif' to select TIFF output.
+ [#2893](https://github.com/lovell/sharp/pull/2893)
+ [@erf](https://github.com/erf)
+
+* Improve error message on Windows for version conflict.
+ [#2918](https://github.com/lovell/sharp/pull/2918)
+ [@dkrnl](https://github.com/dkrnl)
+
+* Throw error rather than exit when invalid binaries detected.
+ [#2931](https://github.com/lovell/sharp/issues/2931)
diff --git a/docs/src/content/docs/changelog/v0.29.3.md b/docs/src/content/docs/changelog/v0.29.3.md
new file mode 100644
index 000000000..e344d790e
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.29.3.md
@@ -0,0 +1,11 @@
+---
+title: v0.29.3 - 14th November 2021
+slug: changelog/v0.29.3
+---
+
+* Ensure correct dimensions when containing image resized to 1px.
+ [#2951](https://github.com/lovell/sharp/issues/2951)
+
+* Impute TIFF `xres`/`yres` from `density` provided to `withMetadata`.
+ [#2952](https://github.com/lovell/sharp/pull/2952)
+ [@mbklein](https://github.com/mbklein)
diff --git a/docs/src/content/docs/changelog/v0.30.0.md b/docs/src/content/docs/changelog/v0.30.0.md
new file mode 100644
index 000000000..2605fbcaa
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.30.0.md
@@ -0,0 +1,48 @@
+---
+title: v0.30.0 - 1st February 2022
+slug: changelog/v0.30.0
+---
+
+* Add support for GIF output to prebuilt binaries.
+
+* Reduce minimum Linux ARM64v8 glibc requirement to 2.17.
+
+* Verify prebuilt binaries with a Subresource Integrity check.
+
+* Standardise WebP `effort` option name, deprecate `reductionEffort`.
+
+* Standardise HEIF `effort` option name, deprecate `speed`.
+
+* Add support for IIIF v3 tile-based output.
+
+* Expose control over CPU effort for palette-based PNG output.
+ [#2541](https://github.com/lovell/sharp/issues/2541)
+
+* Improve animated (multi-page) image resize and extract.
+ [#2789](https://github.com/lovell/sharp/pull/2789)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Expose platform and architecture of vendored binaries as `sharp.vendor`.
+ [#2928](https://github.com/lovell/sharp/issues/2928)
+
+* Ensure 16-bit PNG output uses correct bitdepth.
+ [#2958](https://github.com/lovell/sharp/pull/2958)
+ [@gforge](https://github.com/gforge)
+
+* Properly emit close events for duplex streams.
+ [#2976](https://github.com/lovell/sharp/pull/2976)
+ [@driannaude](https://github.com/driannaude)
+
+* Expose `unlimited` option for SVG and PNG input, switches off safety features.
+ [#2984](https://github.com/lovell/sharp/issues/2984)
+
+* Add `withoutReduction` option to resize operation.
+ [#3006](https://github.com/lovell/sharp/pull/3006)
+ [@christopherbradleybanks](https://github.com/christopherbradleybanks)
+
+* Add `resolutionUnit` as `tiff` option and expose in metadata.
+ [#3023](https://github.com/lovell/sharp/pull/3023)
+ [@ompal-sisodiya](https://github.com/ompal-sisodiya)
+
+* Ensure rotate-then-extract works with EXIF mirroring.
+ [#3024](https://github.com/lovell/sharp/issues/3024)
diff --git a/docs/src/content/docs/changelog/v0.30.1.md b/docs/src/content/docs/changelog/v0.30.1.md
new file mode 100644
index 000000000..06f890da8
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.30.1.md
@@ -0,0 +1,19 @@
+---
+title: v0.30.1 - 9th February 2022
+slug: changelog/v0.30.1
+---
+
+* Allow use of `toBuffer` and `toFile` on the same instance.
+ [#3044](https://github.com/lovell/sharp/issues/3044)
+
+* Skip shrink-on-load for known libjpeg rounding errors.
+ [#3066](https://github.com/lovell/sharp/issues/3066)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Ensure withoutReduction does not interfere with contain/crop/embed.
+ [#3081](https://github.com/lovell/sharp/pull/3081)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Ensure affine interpolator is correctly finalised.
+ [#3083](https://github.com/lovell/sharp/pull/3083)
+ [@kleisauke](https://github.com/kleisauke)
diff --git a/docs/src/content/docs/changelog/v0.30.2.md b/docs/src/content/docs/changelog/v0.30.2.md
new file mode 100644
index 000000000..1b5c7e1c5
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.30.2.md
@@ -0,0 +1,17 @@
+---
+title: v0.30.2 - 2nd March 2022
+slug: changelog/v0.30.2
+---
+
+* Improve performance and accuracy when compositing multiple images.
+ [#2286](https://github.com/lovell/sharp/issues/2286)
+
+* Expand pkgconfig search path for wider BSD support.
+ [#3106](https://github.com/lovell/sharp/issues/3106)
+
+* Ensure Windows C++ runtime is linked statically (regression in 0.30.0).
+ [#3110](https://github.com/lovell/sharp/pull/3110)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Temporarily ignore greyscale ICC profiles to workaround lcms bug.
+ [#3112](https://github.com/lovell/sharp/issues/3112)
diff --git a/docs/src/content/docs/changelog/v0.30.3.md b/docs/src/content/docs/changelog/v0.30.3.md
new file mode 100644
index 000000000..77a2584a8
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.30.3.md
@@ -0,0 +1,13 @@
+---
+title: v0.30.3 - 14th March 2022
+slug: changelog/v0.30.3
+---
+
+* Allow `sharpen` options to be provided more consistently as an Object.
+ [#2561](https://github.com/lovell/sharp/issues/2561)
+
+* Expose `x1`, `y2` and `y3` parameters of `sharpen` operation.
+ [#2935](https://github.com/lovell/sharp/issues/2935)
+
+* Prevent double unpremultiply with some composite blend modes (regression in 0.30.2).
+ [#3118](https://github.com/lovell/sharp/issues/3118)
diff --git a/docs/src/content/docs/changelog/v0.30.4.md b/docs/src/content/docs/changelog/v0.30.4.md
new file mode 100644
index 000000000..a4f0040bf
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.30.4.md
@@ -0,0 +1,20 @@
+---
+title: v0.30.4 - 18th April 2022
+slug: changelog/v0.30.4
+---
+
+* Increase control over sensitivity to invalid images via `failOn`, deprecate `failOnError` (equivalent to `failOn: 'warning'`).
+
+* Ensure `create` input image has correct bit depth and colour space.
+ [#3139](https://github.com/lovell/sharp/issues/3139)
+
+* Add support for `TypedArray` input with `byteOffset` and `length`.
+ [#3146](https://github.com/lovell/sharp/pull/3146)
+ [@codepage949](https://github.com/codepage949)
+
+* Improve error message when attempting to render SVG input greater than 32767x32767.
+ [#3167](https://github.com/lovell/sharp/issues/3167)
+
+* Add missing file name to 'Input file is missing' error message.
+ [#3178](https://github.com/lovell/sharp/pull/3178)
+ [@Brodan](https://github.com/Brodan)
diff --git a/docs/src/content/docs/changelog/v0.30.5.md b/docs/src/content/docs/changelog/v0.30.5.md
new file mode 100644
index 000000000..406357619
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.30.5.md
@@ -0,0 +1,19 @@
+---
+title: v0.30.5 - 23rd May 2022
+slug: changelog/v0.30.5
+---
+
+* Install: pass `PKG_CONFIG_PATH` via env rather than substitution.
+ [@dwisiswant0](https://github.com/dwisiswant0)
+
+* Add support for `--libc` flag to improve cross-platform installation.
+ [#3160](https://github.com/lovell/sharp/pull/3160)
+ [@joonamo](https://github.com/joonamo)
+
+* Allow installation of prebuilt libvips binaries from filesystem.
+ [#3196](https://github.com/lovell/sharp/pull/3196)
+ [@ankurparihar](https://github.com/ankurparihar)
+
+* Fix rotate-then-extract for EXIF orientation 2.
+ [#3218](https://github.com/lovell/sharp/pull/3218)
+ [@jakob0fischl](https://github.com/jakob0fischl)
diff --git a/docs/src/content/docs/changelog/v0.30.6.md b/docs/src/content/docs/changelog/v0.30.6.md
new file mode 100644
index 000000000..340921040
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.30.6.md
@@ -0,0 +1,10 @@
+---
+title: v0.30.6 - 30th May 2022
+slug: changelog/v0.30.6
+---
+
+* Allow values for `limitInputPixels` larger than 32-bit.
+ [#3238](https://github.com/lovell/sharp/issues/3238)
+
+* Ensure brew-installed `vips` can be detected (regression in 0.30.5).
+ [#3239](https://github.com/lovell/sharp/issues/3239)
diff --git a/docs/src/content/docs/changelog/v0.30.7.md b/docs/src/content/docs/changelog/v0.30.7.md
new file mode 100644
index 000000000..fd90d905c
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.30.7.md
@@ -0,0 +1,15 @@
+---
+title: v0.30.7 - 22nd June 2022
+slug: changelog/v0.30.7
+---
+
+* Ensure tiled composition always works with outside resizing.
+ [#3227](https://github.com/lovell/sharp/issues/3227)
+
+* Allow WebP encoding effort of 0.
+ [#3261](https://github.com/lovell/sharp/pull/3261)
+ [@AlexanderTheGrey](https://github.com/AlexanderTheGrey)
+
+* Prevent upsampling via libwebp.
+ [#3267](https://github.com/lovell/sharp/pull/3267)
+ [@blacha](https://github.com/blacha)
diff --git a/docs/src/content/docs/changelog/v0.31.0.md b/docs/src/content/docs/changelog/v0.31.0.md
new file mode 100644
index 000000000..1998f9be8
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.31.0.md
@@ -0,0 +1,63 @@
+---
+title: v0.31.0 - 5th September 2022
+slug: changelog/v0.31.0
+---
+
+* Drop support for Node.js 12, now requires Node.js >= 14.15.0.
+
+* GIF output now re-uses input palette if possible. Use `reoptimise` option to generate a new palette.
+
+* Add WebP `minSize` and `mixed` options for greater control over animation frames.
+
+* Remove previously-deprecated WebP `reductionEffort` and HEIF `speed` options. Use `effort` to control these.
+
+* The `flip` and `flop` operations will now occur before the `rotate` operation.
+
+* Improve `normalise` operation with use of histogram.
+ [#200](https://github.com/lovell/sharp/issues/200)
+
+* Use combined bounding box of alpha and non-alpha channels for `trim` operation.
+ [#2166](https://github.com/lovell/sharp/issues/2166)
+
+* Add Buffer and Stream support to tile-based output.
+ [#2238](https://github.com/lovell/sharp/issues/2238)
+
+* Add input `fileSuffix` and output `alias` to `format` information.
+ [#2642](https://github.com/lovell/sharp/issues/2642)
+
+* Re-introduce support for greyscale ICC profiles (temporarily removed in 0.30.2).
+ [#3114](https://github.com/lovell/sharp/issues/3114)
+
+* Add support for WebP and PackBits `compression` options with TIFF output.
+ [#3198](https://github.com/lovell/sharp/issues/3198)
+
+* Ensure OpenSlide and FITS input works with custom libvips.
+ [#3226](https://github.com/lovell/sharp/issues/3226)
+
+* Ensure `trim` operation is a no-op when it would reduce an image to nothing.
+ [#3223](https://github.com/lovell/sharp/issues/3223)
+
+* Expose `vips_text` to create an image containing rendered text.
+ [#3252](https://github.com/lovell/sharp/pull/3252)
+ [@brahima](https://github.com/brahima)
+
+* Ensure only properties owned by the `withMetadata` EXIF Object are parsed.
+ [#3292](https://github.com/lovell/sharp/issues/3292)
+
+* Expand `linear` operation to allow use of per-channel arrays.
+ [#3303](https://github.com/lovell/sharp/pull/3303)
+ [@antonmarsden](https://github.com/antonmarsden)
+
+* Ensure the order of `rotate`, `resize` and `extend` operations is respected where possible.
+ Emit warnings when previous calls in the same pipeline will be ignored.
+ [#3319](https://github.com/lovell/sharp/issues/3319)
+
+* Ensure PNG bitdepth can be set for non-palette output.
+ [#3322](https://github.com/lovell/sharp/issues/3322)
+
+* Add trim option to provide a specific background colour.
+ [#3332](https://github.com/lovell/sharp/pull/3332)
+ [@mart-jansink](https://github.com/mart-jansink)
+
+* Ensure resized image is unpremultiplied before composite.
+ [#3334](https://github.com/lovell/sharp/issues/3334)
diff --git a/docs/src/content/docs/changelog/v0.31.1.md b/docs/src/content/docs/changelog/v0.31.1.md
new file mode 100644
index 000000000..44467514f
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.31.1.md
@@ -0,0 +1,22 @@
+---
+title: v0.31.1 - 29th September 2022
+slug: changelog/v0.31.1
+---
+
+* Upgrade to libvips v8.13.2 for upstream bug fixes.
+
+* Ensure `close` event occurs after `end` event for Stream-based output.
+ [#3313](https://github.com/lovell/sharp/issues/3313)
+
+* Ensure `limitInputPixels` constructor option uses uint64.
+ [#3349](https://github.com/lovell/sharp/pull/3349)
+ [@marcosc90](https://github.com/marcosc90)
+
+* Ensure auto-rotation works with shrink-on-load and extract (regression in 0.31.0).
+ [#3352](https://github.com/lovell/sharp/issues/3352)
+
+* Ensure AVIF output is always 8-bit.
+ [#3358](https://github.com/lovell/sharp/issues/3358)
+
+* Ensure greyscale images can be trimmed (regression in 0.31.0).
+ [#3386](https://github.com/lovell/sharp/issues/3386)
diff --git a/docs/src/content/docs/changelog/v0.31.2.md b/docs/src/content/docs/changelog/v0.31.2.md
new file mode 100644
index 000000000..c0be292b0
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.31.2.md
@@ -0,0 +1,12 @@
+---
+title: v0.31.2 - 4th November 2022
+slug: changelog/v0.31.2
+---
+
+* Upgrade to libvips v8.13.3 for upstream bug fixes.
+
+* Ensure manual flip, rotate, resize operation ordering (regression in 0.31.1)
+ [#3391](https://github.com/lovell/sharp/issues/3391)
+
+* Ensure auto-rotation works without resize (regression in 0.31.1)
+ [#3422](https://github.com/lovell/sharp/issues/3422)
diff --git a/docs/src/content/docs/changelog/v0.31.3.md b/docs/src/content/docs/changelog/v0.31.3.md
new file mode 100644
index 000000000..84c6ac899
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.31.3.md
@@ -0,0 +1,34 @@
+---
+title: v0.31.3 - 21st December 2022
+slug: changelog/v0.31.3
+---
+
+* Add experimental support for JPEG-XL images. Requires libvips compiled with libjxl.
+ [#2731](https://github.com/lovell/sharp/issues/2731)
+
+* Add runtime detection of V8 memory cage, ensures compatibility with Electron 21 onwards.
+ [#3384](https://github.com/lovell/sharp/issues/3384)
+
+* Expose `interFrameMaxError` and `interPaletteMaxError` GIF optimisation properties.
+ [#3401](https://github.com/lovell/sharp/issues/3401)
+
+* Allow installation on Linux with glibc patch versions e.g. Fedora 38.
+ [#3423](https://github.com/lovell/sharp/issues/3423)
+
+* Expand range of existing `sharpen` parameters to match libvips.
+ [#3427](https://github.com/lovell/sharp/issues/3427)
+
+* Prevent possible race condition awaiting metadata of Stream-based input.
+ [#3451](https://github.com/lovell/sharp/issues/3451)
+
+* Improve `extractChannel` support for 16-bit output colourspaces.
+ [#3453](https://github.com/lovell/sharp/issues/3453)
+
+* Ignore `sequentialRead` option when calculating image statistics.
+ [#3462](https://github.com/lovell/sharp/issues/3462)
+
+* Small performance improvement for operations that introduce a non-opaque background.
+ [#3465](https://github.com/lovell/sharp/issues/3465)
+
+* Ensure integral output of `linear` operation.
+ [#3468](https://github.com/lovell/sharp/issues/3468)
diff --git a/docs/src/content/docs/changelog/v0.32.0.md b/docs/src/content/docs/changelog/v0.32.0.md
new file mode 100644
index 000000000..f86104bfa
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.32.0.md
@@ -0,0 +1,61 @@
+---
+title: v0.32.0 - 24th March 2023
+slug: changelog/v0.32.0
+---
+
+* Default to using sequential rather than random access read where possible.
+
+* Replace GIF output `optimise` / `optimize` option with `reuse`.
+
+* Add `progressive` option to GIF output for interlacing.
+
+* Add `wrap` option to text image creation.
+
+* Add `formatMagick` property to metadata of images loaded via *magick.
+
+* Prefer integer (un)premultiply for faster resizing of RGBA images.
+
+* Add `ignoreIcc` input option to ignore embedded ICC profile.
+
+* Allow use of GPS (IFD3) EXIF metadata.
+ [#2767](https://github.com/lovell/sharp/issues/2767)
+
+* TypeScript definitions are now maintained and published directly, deprecating the `@types/sharp` package.
+ [#3369](https://github.com/lovell/sharp/issues/3369)
+
+* Prebuilt binaries: ensure macOS 10.13+ support, as documented.
+ [#3438](https://github.com/lovell/sharp/issues/3438)
+
+* Prebuilt binaries: prevent use of glib slice allocator, improves QEMU support.
+ [#3448](https://github.com/lovell/sharp/issues/3448)
+
+* Add focus point coordinates to output when using attention based crop.
+ [#3470](https://github.com/lovell/sharp/pull/3470)
+ [@ejoebstl](https://github.com/ejoebstl)
+
+* Expose sharp version as `sharp.versions.sharp`.
+ [#3471](https://github.com/lovell/sharp/issues/3471)
+
+* Respect `fastShrinkOnLoad` resize option for WebP input.
+ [#3516](https://github.com/lovell/sharp/issues/3516)
+
+* Reduce sharpen `sigma` maximum from 10000 to 10.
+ [#3521](https://github.com/lovell/sharp/issues/3521)
+
+* Add support for `ArrayBuffer` input.
+ [#3548](https://github.com/lovell/sharp/pull/3548)
+ [@kapouer](https://github.com/kapouer)
+
+* Add support to `extend` operation for `extendWith` to allow copy/mirror/repeat.
+ [#3556](https://github.com/lovell/sharp/pull/3556)
+ [@janaz](https://github.com/janaz)
+
+* Ensure all async JS callbacks are wrapped to help avoid possible race condition.
+ [#3569](https://github.com/lovell/sharp/issues/3569)
+
+* Prebuilt binaries: support for tile-based output temporarily removed due to licensing issue.
+ [#3581](https://github.com/lovell/sharp/issues/3581)
+
+* Add support to `normalise` for `lower` and `upper` percentiles.
+ [#3583](https://github.com/lovell/sharp/pull/3583)
+ [@LachlanNewman](https://github.com/LachlanNewman)
diff --git a/docs/src/content/docs/changelog/v0.32.1.md b/docs/src/content/docs/changelog/v0.32.1.md
new file mode 100644
index 000000000..a73cfb93e
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.32.1.md
@@ -0,0 +1,30 @@
+---
+title: v0.32.1 - 27th April 2023
+slug: changelog/v0.32.1
+---
+
+* Add experimental `unflatten` operation.
+ [#3461](https://github.com/lovell/sharp/pull/3461)
+ [@antonmarsden](https://github.com/antonmarsden)
+
+* Ensure use of `flip` operation forces random access read (regression in 0.32.0).
+ [#3600](https://github.com/lovell/sharp/issues/3600)
+
+* Ensure `linear` operation works with 16-bit input (regression in 0.31.3).
+ [#3605](https://github.com/lovell/sharp/issues/3605)
+
+* Install: ensure proxy URLs are logged correctly.
+ [#3615](https://github.com/lovell/sharp/pull/3615)
+ [@TomWis97](https://github.com/TomWis97)
+
+* Ensure profile-less CMYK to CMYK roundtrip skips colourspace conversion.
+ [#3620](https://github.com/lovell/sharp/issues/3620)
+
+* Add support for `modulate` operation when using non-sRGB pipeline colourspace.
+ [#3620](https://github.com/lovell/sharp/issues/3620)
+
+* Ensure `trim` operation works with CMYK images (regression in 0.31.0).
+ [#3636](https://github.com/lovell/sharp/issues/3636)
+
+* Install: coerce libc version to semver.
+ [#3641](https://github.com/lovell/sharp/issues/3641)
diff --git a/docs/src/content/docs/changelog/v0.32.2.md b/docs/src/content/docs/changelog/v0.32.2.md
new file mode 100644
index 000000000..a14aa1410
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.32.2.md
@@ -0,0 +1,25 @@
+---
+title: v0.32.2 - 11th July 2023
+slug: changelog/v0.32.2
+---
+
+* Limit HEIF output dimensions to 16384x16384, matches libvips.
+
+* Ensure exceptions are not thrown when terminating.
+ [#3569](https://github.com/lovell/sharp/issues/3569)
+
+* Ensure the same access method is used for all inputs (regression in 0.32.0).
+ [#3669](https://github.com/lovell/sharp/issues/3669)
+
+* Improve detection of jp2 filename extensions.
+ [#3674](https://github.com/lovell/sharp/pull/3674)
+ [@bianjunjie1981](https://github.com/bianjunjie1981)
+
+* Guard use of smartcrop premultiplied option to prevent warning (regression in 0.32.1).
+ [#3710](https://github.com/lovell/sharp/issues/3710)
+
+* Prevent over-compute in affine-based rotate before resize.
+ [#3722](https://github.com/lovell/sharp/issues/3722)
+
+* Allow sequential read for EXIF-based auto-orientation.
+ [#3725](https://github.com/lovell/sharp/issues/3725)
diff --git a/docs/src/content/docs/changelog/v0.32.3.md b/docs/src/content/docs/changelog/v0.32.3.md
new file mode 100644
index 000000000..ac3151982
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.32.3.md
@@ -0,0 +1,10 @@
+---
+title: v0.32.3 - 14th July 2023
+slug: changelog/v0.32.3
+---
+
+* Expose `preset` option for WebP output.
+ [#3639](https://github.com/lovell/sharp/issues/3639)
+
+* Ensure decoding remains sequential for all operations (regression in 0.32.2).
+ [#3725](https://github.com/lovell/sharp/issues/3725)
diff --git a/docs/src/content/docs/changelog/v0.32.4.md b/docs/src/content/docs/changelog/v0.32.4.md
new file mode 100644
index 000000000..f327f8d0b
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.32.4.md
@@ -0,0 +1,11 @@
+---
+title: v0.32.4 - 21st July 2023
+slug: changelog/v0.32.4
+---
+
+* Upgrade to libvips v8.14.3 for upstream bug fixes.
+
+* Expose ability to (un)block low-level libvips operations by name.
+
+* Prebuilt binaries: restore support for tile-based output.
+ [#3581](https://github.com/lovell/sharp/issues/3581)
diff --git a/docs/src/content/docs/changelog/v0.32.5.md b/docs/src/content/docs/changelog/v0.32.5.md
new file mode 100644
index 000000000..3a38ec7ec
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.32.5.md
@@ -0,0 +1,24 @@
+---
+title: v0.32.5 - 15th August 2023
+slug: changelog/v0.32.5
+---
+
+* Upgrade to libvips v8.14.4 for upstream bug fixes.
+
+* TypeScript: Add missing `WebpPresetEnum` to definitions.
+ [#3748](https://github.com/lovell/sharp/pull/3748)
+ [@pilotso11](https://github.com/pilotso11)
+
+* Ensure compilation using musl v1.2.4.
+ [#3755](https://github.com/lovell/sharp/pull/3755)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Ensure resize with a `fit` of `inside` respects 90/270 degree rotation.
+ [#3756](https://github.com/lovell/sharp/issues/3756)
+
+* TypeScript: Ensure `minSize` property of `WebpOptions` is boolean.
+ [#3758](https://github.com/lovell/sharp/pull/3758)
+ [@sho-xizz](https://github.com/sho-xizz)
+
+* Ensure `withMetadata` adds default sRGB profile.
+ [#3761](https://github.com/lovell/sharp/issues/3761)
diff --git a/docs/src/content/docs/changelog/v0.32.6.md b/docs/src/content/docs/changelog/v0.32.6.md
new file mode 100644
index 000000000..6b7c3d431
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.32.6.md
@@ -0,0 +1,19 @@
+---
+title: v0.32.6 - 18th September 2023
+slug: changelog/v0.32.6
+---
+
+* Upgrade to libvips v8.14.5 for upstream bug fixes.
+
+* Ensure composite tile images are fully decoded (regression in 0.32.0).
+ [#3767](https://github.com/lovell/sharp/issues/3767)
+
+* Ensure `withMetadata` can add ICC profiles to RGB16 output.
+ [#3773](https://github.com/lovell/sharp/issues/3773)
+
+* Ensure `withMetadata` does not reduce 16-bit images to 8-bit (regression in 0.32.5).
+ [#3773](https://github.com/lovell/sharp/issues/3773)
+
+* TypeScript: Add definitions for block and unblock.
+ [#3799](https://github.com/lovell/sharp/pull/3799)
+ [@ldrick](https://github.com/ldrick)
diff --git a/docs/src/content/docs/changelog/v0.33.0.md b/docs/src/content/docs/changelog/v0.33.0.md
new file mode 100644
index 000000000..1ca8435de
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.33.0.md
@@ -0,0 +1,47 @@
+---
+title: v0.33.0 - 29th November 2023
+slug: changelog/v0.33.0
+---
+
+* Drop support for Node.js 14 and 16, now requires Node.js ^18.17.0 or >= 20.3.0
+
+* Prebuilt binaries distributed via npm registry and installed via package manager.
+
+* Building from source requires dependency on `node-addon-api`.
+
+* Remove `sharp.vendor`.
+
+* Partially deprecate `withMetadata()`, use `withExif()` and `withIccProfile()`.
+
+* Add experimental support for WebAssembly-based runtimes.
+ [@RReverser](https://github.com/RReverser)
+
+* Options for `trim` operation must be an Object, add new `lineArt` option.
+ [#2363](https://github.com/lovell/sharp/issues/2363)
+
+* Improve luminance of `tint` operation with weighting function.
+ [#3338](https://github.com/lovell/sharp/issues/3338)
+ [@jcupitt](https://github.com/jcupitt)
+
+* Ensure all `Error` objects contain a `stack` property.
+ [#3653](https://github.com/lovell/sharp/issues/3653)
+
+* Make `compression` option of `heif` mandatory to help reduce HEIF vs HEIC confusion.
+ [#3740](https://github.com/lovell/sharp/issues/3740)
+
+* Ensure correct interpretation of 16-bit raw input.
+ [#3808](https://github.com/lovell/sharp/issues/3808)
+
+* Add support for `miniswhite` when using TIFF output.
+ [#3812](https://github.com/lovell/sharp/pull/3812)
+ [@dnsbty](https://github.com/dnsbty)
+
+* TypeScript: add missing definition for `withMetadata` boolean.
+ [#3823](https://github.com/lovell/sharp/pull/3823)
+ [@uhthomas](https://github.com/uhthomas)
+
+* Add more fine-grained control over output metadata.
+ [#3824](https://github.com/lovell/sharp/issues/3824)
+
+* Ensure multi-page extract remains sequential.
+ [#3837](https://github.com/lovell/sharp/issues/3837)
diff --git a/docs/src/content/docs/changelog/v0.33.1.md b/docs/src/content/docs/changelog/v0.33.1.md
new file mode 100644
index 000000000..9a280c82f
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.33.1.md
@@ -0,0 +1,14 @@
+---
+title: v0.33.1 - 17th December 2023
+slug: changelog/v0.33.1
+---
+
+* Add support for Yarn Plug'n'Play filesystem layout.
+ [#3888](https://github.com/lovell/sharp/issues/3888)
+
+* Emit warning when attempting to use invalid ICC profiles.
+ [#3895](https://github.com/lovell/sharp/issues/3895)
+
+* Ensure `VIPS_NOVECTOR` environment variable is respected.
+ [#3897](https://github.com/lovell/sharp/pull/3897)
+ [@icetee](https://github.com/icetee)
diff --git a/docs/src/content/docs/changelog/v0.33.2.md b/docs/src/content/docs/changelog/v0.33.2.md
new file mode 100644
index 000000000..7d88c0adf
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.33.2.md
@@ -0,0 +1,16 @@
+---
+title: v0.33.2 - 12th January 2024
+slug: changelog/v0.33.2
+---
+
+* Upgrade to libvips v8.15.1 for upstream bug fixes.
+
+* TypeScript: add definition for `keepMetadata`.
+ [#3914](https://github.com/lovell/sharp/pull/3914)
+ [@abhi0498](https://github.com/abhi0498)
+
+* Ensure `extend` operation stays sequential when copying (regression in 0.32.0).
+ [#3928](https://github.com/lovell/sharp/issues/3928)
+
+* Improve error handling for unsupported multi-page rotation.
+ [#3940](https://github.com/lovell/sharp/issues/3940)
diff --git a/docs/src/content/docs/changelog/v0.33.3.md b/docs/src/content/docs/changelog/v0.33.3.md
new file mode 100644
index 000000000..17e6639fe
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.33.3.md
@@ -0,0 +1,21 @@
+---
+title: v0.33.3 - 23rd March 2024
+slug: changelog/v0.33.3
+---
+
+* Upgrade to libvips v8.15.2 for upstream bug fixes.
+
+* Ensure `keepIccProfile` retains P3 and CMYK input profiles.
+ [#3906](https://github.com/lovell/sharp/issues/3906)
+ [#4008](https://github.com/lovell/sharp/issues/4008)
+
+* Ensure `text.wrap` property can accept `word-char` as value.
+ [#4028](https://github.com/lovell/sharp/pull/4028)
+ [@yolopunk](https://github.com/yolopunk)
+
+* Ensure `clone` takes a deep copy of existing options.
+ [#4029](https://github.com/lovell/sharp/issues/4029)
+
+* Add `bitdepth` option to `heif` output (prebuilt binaries support 8-bit only).
+ [#4036](https://github.com/lovell/sharp/pull/4036)
+ [@mertalev](https://github.com/mertalev)
diff --git a/docs/src/content/docs/changelog/v0.33.4.md b/docs/src/content/docs/changelog/v0.33.4.md
new file mode 100644
index 000000000..9c4500f91
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.33.4.md
@@ -0,0 +1,32 @@
+---
+title: v0.33.4 - 16th May 2024
+slug: changelog/v0.33.4
+---
+
+* Remove experimental status from `pipelineColourspace`.
+
+* Reduce default concurrency when musl thread over-subscription detected.
+
+* TypeScript: add missing definitions for `OverlayOptions`.
+ [#4048](https://github.com/lovell/sharp/pull/4048)
+ [@ike-gg](https://github.com/ike-gg)
+
+* Install: add advanced option to force use of a globally-installed libvips.
+ [#4060](https://github.com/lovell/sharp/issues/4060)
+
+* Expose `bilinear` resizing kernel (and interpolator).
+ [#4061](https://github.com/lovell/sharp/issues/4061)
+
+* Ensure `extend` operation stays sequential for multi-page TIFF (regression in 0.32.0).
+ [#4069](https://github.com/lovell/sharp/issues/4069)
+
+* Tighten validation of constructor `text` integer properties.
+ [#4071](https://github.com/lovell/sharp/issues/4071)
+
+* Simplify internal StaySequential logic.
+ [#4074](https://github.com/lovell/sharp/pull/4074)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Ensure negate operation occurs after profile conversion.
+ [#4096](https://github.com/lovell/sharp/pull/4096)
+ [@adriaanmeuris](https://github.com/adriaanmeuris)
diff --git a/docs/src/content/docs/changelog/v0.33.5.md b/docs/src/content/docs/changelog/v0.33.5.md
new file mode 100644
index 000000000..7fb99baa2
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.33.5.md
@@ -0,0 +1,39 @@
+---
+title: v0.33.5 - 16th August 2024
+slug: changelog/v0.33.5
+---
+
+* Upgrade to libvips v8.15.3 for upstream bug fixes.
+
+* Add `pageHeight` and `pages` to response of multi-page output.
+ [#3411](https://github.com/lovell/sharp/issues/3411)
+
+* Ensure option to force use of a globally-installed libvips works correctly.
+ [#4111](https://github.com/lovell/sharp/pull/4111)
+ [@project0](https://github.com/project0)
+
+* Minimise use of `engines` property to improve yarn v1 support.
+ [#4130](https://github.com/lovell/sharp/issues/4130)
+
+* Ensure `sharp.format.heif` includes only AVIF when using prebuilt binaries.
+ [#4132](https://github.com/lovell/sharp/issues/4132)
+
+* Add support to recomb operation for 4x4 matrices.
+ [#4147](https://github.com/lovell/sharp/pull/4147)
+ [@ton11797](https://github.com/ton11797)
+
+* Expose PNG text chunks as `comments` metadata.
+ [#4157](https://github.com/lovell/sharp/pull/4157)
+ [@nkeynes](https://github.com/nkeynes)
+
+* Expose optional `precision` and `minAmplitude` parameters of `blur` operation.
+ [#4168](https://github.com/lovell/sharp/pull/4168)
+ [#4172](https://github.com/lovell/sharp/pull/4172)
+ [@marcosc90](https://github.com/marcosc90)
+
+* Ensure `keepIccProfile` avoids colour transformation where possible.
+ [#4186](https://github.com/lovell/sharp/issues/4186)
+
+* TypeScript: `chromaSubsampling` metadata is optional.
+ [#4191](https://github.com/lovell/sharp/pull/4191)
+ [@DavidVaness](https://github.com/DavidVaness)
diff --git a/docs/src/content/docs/changelog/v0.34.0.md b/docs/src/content/docs/changelog/v0.34.0.md
new file mode 100644
index 000000000..4fc83109e
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.34.0.md
@@ -0,0 +1,52 @@
+---
+title: v0.34.0 - 4th April 2025
+slug: changelog/v0.34.0
+---
+
+* Breaking: Support array of input images to be joined or animated.
+ [#1580](https://github.com/lovell/sharp/issues/1580)
+
+* Breaking: Ensure `removeAlpha` removes all alpha channels.
+ [#2266](https://github.com/lovell/sharp/issues/2266)
+
+* Breaking: Non-animated GIF output defaults to no-loop instead of loop-forever.
+ [#3394](https://github.com/lovell/sharp/issues/3394)
+
+* Breaking: Support `info.size` on wide-character systems via upgrade to C++17.
+ [#3943](https://github.com/lovell/sharp/issues/3943)
+
+* Breaking: Ensure `background` metadata can be parsed by `color` package.
+ [#4090](https://github.com/lovell/sharp/issues/4090)
+
+* Add `isPalette` and `bitsPerSample` to metadata, deprecate `paletteBitDepth`.
+
+* Expose WebP `smartDeblock` output option.
+
+* Prevent use of linux-x64 binaries with v1 microarchitecture.
+
+* Add `autoOrient` operation and constructor option.
+ [#4151](https://github.com/lovell/sharp/pull/4151)
+ [@happycollision](https://github.com/happycollision)
+
+* TypeScript: Ensure channel counts use the correct range.
+ [#4197](https://github.com/lovell/sharp/pull/4197)
+ [@DavidVaness](https://github.com/DavidVaness)
+
+* Improve support for ppc64le architecture.
+ [#4203](https://github.com/lovell/sharp/pull/4203)
+ [@sumitd2](https://github.com/sumitd2)
+
+* Add `pdfBackground` constructor property.
+ [#4207](https://github.com/lovell/sharp/pull/4207)
+ [@calebmer](https://github.com/calebmer)
+
+* Expose erode and dilate operations.
+ [#4243](https://github.com/lovell/sharp/pull/4243)
+ [@qpincon](https://github.com/qpincon)
+
+* Add support for RGBE images. Requires libvips compiled with radiance support.
+ [#4316](https://github.com/lovell/sharp/pull/4316)
+ [@florentzabera](https://github.com/florentzabera)
+
+* Allow wide-gamut HEIF output at higher bitdepths.
+ [#4344](https://github.com/lovell/sharp/issues/4344)
diff --git a/docs/src/content/docs/changelog/v0.34.1.md b/docs/src/content/docs/changelog/v0.34.1.md
new file mode 100644
index 000000000..a5ae94dcf
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.34.1.md
@@ -0,0 +1,8 @@
+---
+title: v0.34.1 - 7th April 2025
+slug: changelog/v0.34.1
+---
+
+* TypeScript: Ensure new `autoOrient` property is optional.
+ [#4362](https://github.com/lovell/sharp/pull/4362)
+ [@styfle](https://github.com/styfle)
diff --git a/docs/src/content/docs/changelog/v0.34.2.md b/docs/src/content/docs/changelog/v0.34.2.md
new file mode 100644
index 000000000..2292304ea
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.34.2.md
@@ -0,0 +1,28 @@
+---
+title: v0.34.2 - 20th May 2025
+slug: changelog/v0.34.2
+---
+
+* Ensure animated GIF to WebP conversion retains loop (regression in 0.34.0).
+ [#3394](https://github.com/lovell/sharp/issues/3394)
+
+* Ensure `pdfBackground` constructor property is used.
+ [#4207](https://github.com/lovell/sharp/pull/4207)
+ [#4398](https://github.com/lovell/sharp/issues/4398)
+
+* Add experimental support for prebuilt Windows ARM64 binaries.
+ [#4375](https://github.com/lovell/sharp/pull/4375)
+ [@hans00](https://github.com/hans00)
+
+* Ensure resizing with a `fit` of `contain` supports multiple alpha channels.
+ [#4382](https://github.com/lovell/sharp/issues/4382)
+
+* TypeScript: Ensure `metadata` response more closely matches reality.
+ [#4383](https://github.com/lovell/sharp/issues/4383)
+
+* TypeScript: Ensure `smartDeblock` property is included in WebP definition.
+ [#4387](https://github.com/lovell/sharp/pull/4387)
+ [@Stephen-X](https://github.com/Stephen-X)
+
+* Ensure support for wide-character filenames on Windows (regression in 0.34.0).
+ [#4391](https://github.com/lovell/sharp/issues/4391)
diff --git a/docs/src/content/docs/changelog/v0.34.3.md b/docs/src/content/docs/changelog/v0.34.3.md
new file mode 100644
index 000000000..1f3016741
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.34.3.md
@@ -0,0 +1,33 @@
+---
+title: v0.34.3 - 10th July 2025
+slug: changelog/v0.34.3
+---
+
+* Upgrade to libvips v8.17.1 for upstream bug fixes.
+
+* Add "Magic Kernel Sharp" (no relation) to resizing kernels.
+
+* Deprecate top-level, format-specific constructor parameters, e.g. `subifd` becomes `tiff.subifd`.
+
+* Expose `stylesheet` and `highBitdepth` SVG input parameters.
+
+* Expose `keepDuplicateFrames` GIF output parameter.
+
+* Add support for RAW digital camera image input. Requires libvips compiled with libraw support.
+
+* Provide XMP metadata as a string, as well as a Buffer, where possible.
+
+* Add `pageHeight` option to `create` and `raw` input for animated images.
+ [#3236](https://github.com/lovell/sharp/issues/3236)
+
+* Expose JPEG 2000 `oneshot` decoder option.
+ [#4262](https://github.com/lovell/sharp/pull/4262)
+ [@mbklein](https://github.com/mbklein)
+
+* Support composite operation with non-sRGB pipeline colourspace.
+ [#4412](https://github.com/lovell/sharp/pull/4412)
+ [@kleisauke](https://github.com/kleisauke)
+
+* Add `keepXmp` and `withXmp` for control over output XMP metadata.
+ [#4416](https://github.com/lovell/sharp/pull/4416)
+ [@tpatel](https://github.com/tpatel)
diff --git a/docs/src/content/docs/changelog/v0.34.4.md b/docs/src/content/docs/changelog/v0.34.4.md
new file mode 100644
index 000000000..83c95ce43
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.34.4.md
@@ -0,0 +1,28 @@
+---
+title: v0.34.4 - 17th September 2025
+slug: changelog/v0.34.4
+---
+
+* Upgrade to libvips v8.17.2 for upstream bug fixes.
+
+* Ensure TIFF `subifd` and OpenSlide `level` input options are respected (regression in 0.34.3).
+
+* Ensure `autoOrient` occurs before non-90 angle rotation.
+ [#4425](https://github.com/lovell/sharp/issues/4425)
+
+* Ensure `autoOrient` removes existing metadata after shrink-on-load.
+ [#4431](https://github.com/lovell/sharp/issues/4431)
+
+* TypeScript: Ensure `KernelEnum` includes `linear`.
+ [#4441](https://github.com/lovell/sharp/pull/4441)
+ [@BayanBennett](https://github.com/BayanBennett)
+
+* Ensure `unlimited` flag is passed upstream when reading TIFF images.
+ [#4446](https://github.com/lovell/sharp/issues/4446)
+
+* Support Electron memory cage when reading XMP metadata (regression in 0.34.3).
+ [#4451](https://github.com/lovell/sharp/issues/4451)
+
+* Add sharp-libvips rpath for yarn v5 support.
+ [#4452](https://github.com/lovell/sharp/pull/4452)
+ [@arcanis](https://github.com/arcanis)
diff --git a/docs/src/content/docs/changelog/v0.34.5.md b/docs/src/content/docs/changelog/v0.34.5.md
new file mode 100644
index 000000000..d8321baa4
--- /dev/null
+++ b/docs/src/content/docs/changelog/v0.34.5.md
@@ -0,0 +1,21 @@
+---
+title: v0.34.5 - 6th November 2025
+slug: changelog/v0.34.5
+---
+
+* Upgrade to libvips v8.17.3 for upstream bug fixes.
+
+* Add experimental support for prebuilt Linux RISC-V 64-bit binaries.
+
+* Support building from source with npm v12+, deprecate `--build-from-source` flag.
+ [#4458](https://github.com/lovell/sharp/issues/4458)
+
+* Add support for BigTIFF output.
+ [#4459](https://github.com/lovell/sharp/pull/4459)
+ [@throwbi](https://github.com/throwbi)
+
+* Improve error messaging when only warnings issued.
+ [#4465](https://github.com/lovell/sharp/issues/4465)
+
+* Simplify ICC processing when retaining input profiles.
+ [#4468](https://github.com/lovell/sharp/issues/4468)
diff --git a/docs/README.md b/docs/src/content/docs/index.md
similarity index 73%
rename from docs/README.md
rename to docs/src/content/docs/index.md
index 52ae9b316..3ba704f43 100644
--- a/docs/README.md
+++ b/docs/src/content/docs/index.md
@@ -1,10 +1,16 @@
-# sharp
+---
+title: "High performance Node.js image processing"
+---
-
+
-The typical use case for this high speed Node.js module
+The typical use case for this high speed Node-API module
is to convert large images in common formats to
-smaller, web-friendly JPEG, PNG, AVIF and WebP images of varying dimensions.
+smaller, web-friendly JPEG, PNG, WebP, GIF and AVIF images of varying dimensions.
+
+It can be used with all JavaScript runtimes
+that provide support for Node-API v9, including
+Node.js >= 18.17.0, Deno and Bun.
Resizing an image is typically 4x-5x faster than using the
quickest ImageMagick and GraphicsMagick settings
@@ -16,14 +22,18 @@ Lanczos resampling ensures quality is not sacrificed for speed.
As well as image resizing, operations such as
rotation, extraction, compositing and gamma correction are available.
-Most modern macOS, Windows and Linux systems running Node.js v10+
+Most modern macOS, Windows and Linux systems
do not require any additional install or runtime dependencies.
-### Formats
+```sh frame="none"
+npm install sharp
+```
+
+## Formats
-This module supports reading JPEG, PNG, WebP, AVIF, TIFF, GIF and SVG images.
+This module supports reading JPEG, PNG, WebP, GIF, AVIF, TIFF and SVG images.
-Output images can be in JPEG, PNG, WebP, AVIF and TIFF formats as well as uncompressed raw pixel data.
+Output images can be in JPEG, PNG, WebP, GIF, AVIF and TIFF formats as well as uncompressed raw pixel data.
Streams, Buffer objects and the filesystem can be used for input and output.
@@ -33,7 +43,7 @@ Deep Zoom image pyramids can be generated,
suitable for use with "slippy map" tile viewers like
[OpenSeadragon](https://github.com/openseadragon/openseadragon).
-### Fast
+## Fast
This module is powered by the blazingly fast
[libvips](https://github.com/libvips/libvips) image processing library,
@@ -48,7 +58,7 @@ taking full advantage of multiple CPU cores and L1/L2/L3 cache.
Everything remains non-blocking thanks to _libuv_,
no child processes are spawned and Promises/async/await are supported.
-### Optimal
+## Optimal
The features of `mozjpeg` and `pngquant` can be used
to optimise the file size of JPEG and PNG images respectively,
@@ -63,14 +73,18 @@ PNG filtering is disabled by default,
which for diagrams and line art often produces the same result
as [pngcrush](https://pmt.sourceforge.io/pngcrush/).
-### Contributing
+The file size of animated GIF output is optimised
+without having to use separate command line tools such as
+[gifsicle](https://www.lcdf.org/gifsicle/).
+
+## Contributing
-A [guide for contributors](https://github.com/lovell/sharp/blob/master/.github/CONTRIBUTING.md)
+A [guide for contributors](https://github.com/lovell/sharp/blob/main/.github/CONTRIBUTING.md)
covers reporting bugs, requesting features and submitting code changes.
-### Licensing
+## Licensing
-Copyright 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Lovell Fuller and contributors.
+Copyright 2013 Lovell Fuller and others.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/docs/src/content/docs/install.md b/docs/src/content/docs/install.md
new file mode 100644
index 000000000..083db5ccd
--- /dev/null
+++ b/docs/src/content/docs/install.md
@@ -0,0 +1,361 @@
+---
+title: Installation
+---
+
+Works with your choice of JavaScript package manager.
+
+:::caution
+Please ensure your package manager is configured to install optional dependencies
+:::
+
+If a package manager lockfile must support multiple platforms,
+please see the [cross-platform](#cross-platform) section
+to help decide which package manager is appropriate.
+
+```sh frame="none"
+npm install sharp
+```
+
+```sh frame="none"
+pnpm add sharp
+```
+
+When using `pnpm`, add `sharp` to
+[ignoredBuiltDependencies](https://pnpm.io/settings#ignoredbuiltdependencies)
+to silence warnings.
+
+```sh frame="none"
+yarn add sharp
+```
+
+```sh frame="none"
+bun add sharp
+```
+
+```sh frame="none"
+deno add --quiet npm:sharp
+deno run --allow-env --allow-ffi --allow-read --allow-sys ...
+```
+
+## Prerequisites
+
+* Node-API v9 compatible runtime e.g. Node.js ^18.17.0 or >=20.3.0.
+
+## Prebuilt binaries
+
+Ready-compiled sharp and libvips binaries are provided for use on the most common platforms:
+
+* macOS x64 (>= 10.15)
+* macOS ARM64
+* Linux ARM (glibc >= 2.31)
+* Linux ARM64 (glibc >= 2.26, musl >= 1.2.2)
+* Linux RISC-V 64-bit (glibc >= 2.41)
+* Linux ppc64 (glibc >= 2.36)
+* Linux s390x (glibc >= 2.36)
+* Linux x64 (glibc >= 2.26, musl >= 1.2.2, CPU with SSE4.2)
+* Windows x64
+* Windows x86
+* Windows ARM64 (experimental, CPU with ARMv8.4 required for all features)
+
+This provides support for the
+JPEG, PNG, WebP, AVIF (limited to 8-bit depth), TIFF, GIF and SVG (input) image formats.
+
+## Cross-platform
+
+At install time, package managers will automatically select prebuilt binaries
+for the current OS platform and CPU architecture, where available.
+
+Some package managers support multiple platforms and architectures
+within the same installation tree and/or using the same lockfile.
+
+### npm v10+
+
+:::caution
+npm `package-lock.json` files shared by multiple platforms can cause installation problems due to [npm bug #4828](https://github.com/npm/cli/issues/4828)
+:::
+
+Provides limited support via `--os`, `--cpu` and `--libc` flags.
+
+To support macOS with Intel x64 and ARM64 CPUs:
+```sh frame="none"
+npm install --cpu=x64 --os=darwin sharp
+npm install --cpu=arm64 --os=darwin sharp
+```
+
+When the cross-target is Linux, the C standard library must be specified.
+
+To support glibc (e.g. Debian) and musl (e.g. Alpine) Linux with Intel x64 CPUs:
+```sh frame="none"
+npm install --cpu=x64 --os=linux --libc=glibc sharp
+npm install --cpu=x64 --os=linux --libc=musl sharp
+```
+
+### yarn v3+
+
+Use the [supportedArchitectures](https://yarnpkg.com/configuration/yarnrc#supportedArchitectures) configuration.
+
+### pnpm v8+
+
+Use the [supportedArchitectures](https://pnpm.io/settings#supportedarchitectures) configuration.
+
+## Custom libvips
+
+To use a custom, globally-installed version of libvips instead of the provided binaries,
+make sure it is at least the version listed under `config.libvips` in the `package.json` file
+and that it can be located using `pkg-config --modversion vips-cpp`.
+
+For help compiling libvips and its dependencies, please see
+[building libvips from source](https://www.libvips.org/install.html#building-libvips-from-source).
+
+The use of a globally-installed libvips is unsupported on Windows
+and on macOS when running Node.js under Rosetta.
+
+## Building from source
+
+This module will be compiled from source when:
+
+* a globally-installed libvips is detected, or
+* using `npm explore sharp -- npm run build`, or
+* using the deprecated `npm run --build-from-source` at `npm install` time.
+
+The logic to detect a globally-installed libvips can be skipped by setting the
+`SHARP_IGNORE_GLOBAL_LIBVIPS` (never try to use it) or
+`SHARP_FORCE_GLOBAL_LIBVIPS` (always try to use it, even when missing or outdated)
+environment variables.
+
+Building from source requires:
+
+* C++17 compiler
+* [node-addon-api](https://www.npmjs.com/package/node-addon-api) version 7+
+* [node-gyp](https://github.com/nodejs/node-gyp#installation) version 9+ and its dependencies
+
+There is an install-time check for these dependencies.
+If `node-addon-api` or `node-gyp` cannot be found, try adding them via:
+
+```sh frame="none"
+npm install --save node-addon-api node-gyp
+```
+
+When using `pnpm`, you may need to add `sharp` to
+[onlyBuiltDependencies](https://pnpm.io/settings#onlybuiltdependencies)
+to ensure the installation script can be run.
+
+For cross-compiling, the `--platform`, `--arch` and `--libc` npm flags
+(or the `npm_config_platform`, `npm_config_arch` and `npm_config_libc` environment variables)
+can be used to configure the target environment.
+
+## WebAssembly
+
+Experimental support is provided for runtime environments that provide
+multi-threaded Wasm via Workers.
+
+Use in web browsers is unsupported.
+
+Native text rendering is unsupported.
+
+[Tile-based output](/api-output#tile) is unsupported.
+
+```sh frame="none"
+npm install --cpu=wasm32 sharp
+```
+
+## FreeBSD
+
+The `vips` package must be installed before `npm install` is run,
+as well as the additional [building from source](#building-from-source) dependencies.
+
+```sh frame="none"
+pkg install -y pkgconf vips
+```
+
+```sh frame="none"
+cd /usr/ports/graphics/vips/ && make install clean
+```
+
+## Linux memory allocator
+
+The default memory allocator on most glibc-based Linux systems
+(e.g. Debian, Red Hat) is unsuitable for long-running, multi-threaded
+processes that involve lots of small memory allocations.
+
+For this reason, by default, sharp will limit the use of thread-based
+[concurrency](/api-utility#concurrency) when the glibc allocator is
+detected at runtime.
+
+To help avoid fragmentation and improve performance on these systems,
+the use of an alternative memory allocator such as
+[jemalloc](https://github.com/jemalloc/jemalloc) is recommended.
+
+Those using musl-based Linux (e.g. Alpine) and non-Linux systems are
+unaffected.
+
+## AWS Lambda
+
+The `node_modules` directory of the
+[deployment package](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-package.html)
+must include binaries for either the linux-x64 or linux-arm64 platforms
+depending on the chosen architecture.
+
+When building your deployment package on a machine that differs from the target architecture,
+see the [cross-platform](#cross-platform) section to help decide which package manager is appropriate
+and how to configure it.
+
+Some package managers use symbolic links
+but AWS Lambda does not support these within deployment packages.
+
+To get the best performance select the largest memory available.
+A 1536 MB function provides ~12x more CPU time than a 128 MB function.
+
+When integrating with AWS API Gateway, ensure it is configured with the relevant
+[binary media types](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings.html).
+
+## Bundlers
+
+### webpack
+
+Ensure sharp is excluded from bundling via the
+[externals](https://webpack.js.org/configuration/externals/)
+configuration.
+
+```js frame="none"
+externals: {
+ 'sharp': 'commonjs sharp'
+}
+```
+
+### esbuild
+
+Ensure sharp is excluded from bundling via the
+[external](https://esbuild.github.io/api/#external)
+configuration.
+
+```js frame="none"
+buildSync({
+ entryPoints: ['app.js'],
+ bundle: true,
+ platform: 'node',
+ external: ['sharp'],
+})
+```
+
+```sh frame="none"
+esbuild app.js --bundle --platform=node --external:sharp
+```
+
+For `serverless-esbuild`, ensure platform-specific binaries are installed
+via the `serverless.yml` configuration.
+
+```yaml frame="none"
+custom:
+ esbuild:
+ external:
+ - sharp
+ packagerOptions:
+ scripts:
+ - npm install --os=linux --cpu=x64 sharp
+```
+
+### electron
+
+#### electron-builder
+
+Ensure `sharp` is unpacked from the ASAR archive file using the
+[asarUnpack](https://www.electron.build/app-builder-lib.interface.platformspecificbuildoptions#asarunpack)
+option.
+
+```json frame="none"
+{
+ "build": {
+ "asar": true,
+ "asarUnpack": [
+ "**/node_modules/sharp/**/*",
+ "**/node_modules/@img/**/*"
+ ]
+ }
+}
+```
+
+#### electron-forge
+
+Ensure `sharp` is unpacked from the ASAR archive file using the
+[unpack](https://js.electronforge.io/interfaces/_electron_forge_maker_squirrel.InternalOptions.Options.html#asar)
+option.
+
+```json frame="none"
+{
+ "packagerConfig": {
+ "asar": {
+ "unpack": "**/node_modules/{sharp,@img}/**/*"
+ }
+ }
+}
+```
+
+When using `electron-forge` with [Webpack](#webpack),
+you may also need to add
+[forge-externals-plugin](https://www.npmjs.com/package/@timfish/forge-externals-plugin).
+
+### vite
+
+Ensure `sharp` is excluded from bundling via the
+[build.rollupOptions](https://vitejs.dev/config/build-options.html)
+configuration.
+
+```js frame="none"
+import { defineConfig } from 'vite';
+
+export default defineConfig({
+ build: {
+ rollupOptions: {
+ external: [
+ "sharp"
+ ]
+ }
+ }
+});
+```
+
+## TypeScript
+
+TypeScript definitions are published as part of
+the `sharp` package from v0.32.0.
+
+Previously these were available via the `@types/sharp` package,
+which is now deprecated.
+
+When using Typescript, please ensure `devDependencies` includes
+the `@types/node` package.
+
+## Fonts
+
+When creating text images or rendering SVG images that contain text elements,
+`fontconfig` is used to find the relevant fonts.
+
+On Windows and macOS systems, all system fonts are available for use.
+
+On macOS systems using Homebrew, you may need to set the
+`PANGOCAIRO_BACKEND` environment variable to a value of `fontconfig`
+to ensure it is used for font discovery instead of Core Text.
+
+On Linux systems, fonts that include the relevant
+[`fontconfig` configuration](https://www.freedesktop.org/software/fontconfig/fontconfig-user.html)
+when installed via package manager are available for use.
+
+If `fontconfig` configuration is not found, the following error will occur:
+```
+Fontconfig error: Cannot load default config file
+```
+
+In serverless environments where there is no control over font packages,
+use the `FONTCONFIG_PATH` environment variable to point to a custom location.
+
+Embedded SVG fonts are unsupported.
+
+## Known conflicts
+
+### Canvas and Windows
+
+If both `canvas` and `sharp` modules are used in the same Windows process, the following error may occur:
+```
+The specified procedure could not be found.
+```
diff --git a/docs/src/content/docs/performance.md b/docs/src/content/docs/performance.md
new file mode 100644
index 000000000..19aead63d
--- /dev/null
+++ b/docs/src/content/docs/performance.md
@@ -0,0 +1,138 @@
+---
+title: Performance
+---
+
+## Parallelism and concurrency
+
+Node.js uses a libuv-managed thread pool when processing asynchronous calls to native modules such as sharp.
+
+The maximum number of images that sharp can process in parallel is controlled by libuv's
+[`UV_THREADPOOL_SIZE`](https://nodejs.org/api/cli.html#uv_threadpool_sizesize)
+environment variable, which defaults to 4.
+
+When using more than 4 physical CPU cores, set this environment variable
+before the Node.js process starts to increase the thread pool size.
+
+```sh frame="none"
+export UV_THREADPOOL_SIZE="$(lscpu -p | egrep -v "^#" | sort -u -t, -k 2,4 | wc -l)"
+```
+
+libvips uses a shared thread pool to avoid the overhead of spawning new threads.
+The size of this thread pool will grow on demand and shrink when idle.
+
+The default number of threads used to concurrently process each image is the same as the number of CPU cores,
+except when using glibc-based Linux without jemalloc, where the default is `1` to help reduce memory fragmentation.
+
+Use [`sharp.concurrency()`](/api-utility/#concurrency) to manage the number of threads per image.
+
+To reduce memory fragmentation when using the default Linux glibc memory allocator, set the
+[`MALLOC_ARENA_MAX`](https://sourceware.org/glibc/manual/latest/html_node/Memory-Allocation-Tunables.html)
+environment variable before the Node.js process starts to reduce the number of memory pools.
+
+```sh frame="none"
+export MALLOC_ARENA_MAX="2"
+```
+
+## Benchmark
+
+A test to benchmark the performance of this module relative to alternatives.
+
+Greater libvips performance can be expected with caching enabled (default)
+and using 8+ core machines, especially those with larger L1/L2 CPU caches.
+
+The I/O limits of the relevant (de)compression library will generally determine maximum throughput.
+
+### Contenders
+
+- [jimp](https://www.npmjs.com/package/jimp) v1.6.0 - Image processing in pure JavaScript.
+- [imagemagick](https://www.npmjs.com/package/imagemagick) v0.1.3 - Supports filesystem only and "_has been unmaintained for a long time_".
+- [gm](https://www.npmjs.com/package/gm) v1.25.1 - Fully featured wrapper around GraphicsMagick's `gm` command line utility, but "_has been sunset_".
+- sharp v0.34.3 / libvips v8.17.0 - Caching within libvips disabled to ensure a fair comparison.
+
+### Environment
+
+#### AMD64
+
+- AWS EC2 us-west-2 [c7a.xlarge](https://aws.amazon.com/ec2/instance-types/c7a/) (4x AMD EPYC 9R14)
+- Ubuntu 25.04
+- Node.js 24.3.0
+
+#### ARM64
+
+- AWS EC2 us-west-2 [c8g.xlarge](https://aws.amazon.com/ec2/instance-types/c8g/) (4x ARM Graviton4)
+- Ubuntu 25.04
+- Node.js 24.3.0
+
+### Task: JPEG
+
+Decompress a 2725x2225 JPEG image,
+resize to 720x588 using Lanczos 3 resampling (where available),
+then compress to JPEG at a "quality" setting of 80.
+
+Note: jimp does not support Lanczos 3, bicubic resampling used instead.
+
+#### Results: JPEG (AMD64)
+
+| Package | I/O | Ops/sec | Speed-up |
+| :---------- | :----- | ------: | -------: |
+| jimp | buffer | 2.40 | 1.0 |
+| jimp | file | 2.60 | 1.1 |
+| imagemagick | file | 9.70 | 4.0 |
+| gm | buffer | 11.60 | 4.8 |
+| gm | file | 11.72 | 4.9 |
+| sharp | stream | 59.40 | 24.8 |
+| sharp | file | 62.67 | 26.1 |
+| sharp | buffer | 64.42 | 26.8 |
+
+#### Results: JPEG (ARM64)
+
+| Package | I/O | Ops/sec | Speed-up |
+| :---------- | :----- | ------: | -------: |
+| jimp | buffer | 2.24 | 1.0 |
+| jimp | file | 2.47 | 1.1 |
+| imagemagick | file | 10.42 | 4.7 |
+| gm | buffer | 12.80 | 5.7 |
+| gm | file | 12.88 | 5.7 |
+| sharp | stream | 45.58 | 20.3 |
+| sharp | file | 47.99 | 21.4 |
+| sharp | buffer | 49.20 | 22.0 |
+
+### Task: PNG
+
+Decompress a 2048x1536 RGBA PNG image,
+premultiply the alpha channel,
+resize to 720x540 using Lanczos 3 resampling (where available),
+unpremultiply then compress as PNG with a "default" zlib compression level of 6
+and without adaptive filtering.
+
+Note: jimp does not support premultiply/unpremultiply.
+
+#### Results: PNG (AMD64)
+
+| Package | I/O | Ops/sec | Speed-up |
+| :---------- | :----- | ------: | -------: |
+| imagemagick | file | 6.06 | 1.0 |
+| gm | file | 8.44 | 1.4 |
+| jimp | buffer | 10.98 | 1.8 |
+| sharp | file | 28.26 | 4.7 |
+| sharp | buffer | 28.70 | 4.7 |
+
+#### Results: PNG (ARM64)
+
+| Package | I/O | Ops/sec | Speed-up |
+| :---------- | :----- | ------: | -------: |
+| imagemagick | file | 7.09 | 1.0 |
+| gm | file | 8.93 | 1.3 |
+| jimp | buffer | 10.28 | 1.5 |
+| sharp | file | 23.81 | 3.4 |
+| sharp | buffer | 24.19 | 3.4 |
+
+## Running the benchmark test
+
+Requires Docker.
+
+```sh frame="none"
+git clone https://github.com/lovell/sharp.git
+cd sharp/test/bench
+./run-with-docker.sh
+```
diff --git a/docs/src/styles/custom.css b/docs/src/styles/custom.css
new file mode 100644
index 000000000..197ccf567
--- /dev/null
+++ b/docs/src/styles/custom.css
@@ -0,0 +1,45 @@
+@view-transition {
+ navigation: auto;
+}
+
+:root {
+ --sl-content-width: 60rem;
+ --sl-color-accent-low: #072d00;
+ --sl-color-accent: #247f00;
+ --sl-color-accent-high: #aad7a0;
+ --sl-color-white: #ffffff;
+ --sl-color-gray-1: #eaf0e8;
+ --sl-color-gray-2: #c5cdc3;
+ --sl-color-gray-3: #99a796;
+ --sl-color-gray-4: #4f5c4d;
+ --sl-color-gray-5: #303c2d;
+ --sl-color-gray-6: #1f2a1c;
+ --sl-color-black: #151a13;
+}
+
+:root[data-theme="light"] {
+ --sl-color-accent-low: #c0e2b8;
+ --sl-color-accent: #165800;
+ --sl-color-accent-high: #0d3e00;
+ --sl-color-white: #151a13;
+ --sl-color-gray-1: #1f2a1c;
+ --sl-color-gray-2: #303c2d;
+ --sl-color-gray-3: #4f5c4d;
+ --sl-color-gray-4: #82907f;
+ --sl-color-gray-5: #bdc4bb;
+ --sl-color-gray-6: #eaf0e8;
+ --sl-color-gray-7: #f4f7f3;
+ --sl-color-black: #ffffff;
+}
+
+blockquote {
+ background-color: var(--sl-color-gray-6);
+ padding: 1rem;
+}
+
+.site-title::after {
+ content: "High performance Node.js image processing";
+ color: var(--sl-color-text);
+ font-size: var(--sl-text-sm);
+ padding-top: 0.3rem;
+}
diff --git a/docs/tsconfig.json b/docs/tsconfig.json
new file mode 100644
index 000000000..8bf91d3bb
--- /dev/null
+++ b/docs/tsconfig.json
@@ -0,0 +1,5 @@
+{
+ "extends": "astro/tsconfigs/strict",
+ "include": [".astro/types.d.ts", "**/*"],
+ "exclude": ["dist"]
+}
diff --git a/install/build.js b/install/build.js
new file mode 100644
index 000000000..2ca224586
--- /dev/null
+++ b/install/build.js
@@ -0,0 +1,38 @@
+/*!
+ Copyright 2013 Lovell Fuller and others.
+ SPDX-License-Identifier: Apache-2.0
+*/
+
+const {
+ useGlobalLibvips,
+ globalLibvipsVersion,
+ log,
+ spawnRebuild,
+} = require('../lib/libvips');
+
+log('Attempting to build from source via node-gyp');
+log('See https://sharp.pixelplumbing.com/install#building-from-source');
+
+try {
+ const addonApi = require('node-addon-api');
+ log(`Found node-addon-api ${addonApi.version || ''}`);
+} catch (_err) {
+ log('Please add node-addon-api to your dependencies');
+ process.exit(1);
+}
+try {
+ const gyp = require('node-gyp');
+ log(`Found node-gyp ${gyp().version}`);
+} catch (_err) {
+ log('Please add node-gyp to your dependencies');
+ process.exit(1);
+}
+
+if (useGlobalLibvips(log)) {
+ log(`Detected globally-installed libvips v${globalLibvipsVersion()}`);
+}
+
+const status = spawnRebuild();
+if (status !== 0) {
+ process.exit(status);
+}
diff --git a/install/check.js b/install/check.js
new file mode 100644
index 000000000..1cfb7d32e
--- /dev/null
+++ b/install/check.js
@@ -0,0 +1,14 @@
+/*!
+ Copyright 2013 Lovell Fuller and others.
+ SPDX-License-Identifier: Apache-2.0
+*/
+
+try {
+ const { useGlobalLibvips } = require('../lib/libvips');
+ if (useGlobalLibvips() || process.env.npm_config_build_from_source) {
+ process.exit(1);
+ }
+} catch (err) {
+ const summary = err.message.split(/\n/).slice(0, 1);
+ console.log(`sharp: skipping install check: ${summary}`);
+}
diff --git a/install/dll-copy.js b/install/dll-copy.js
deleted file mode 100644
index 41449ddd2..000000000
--- a/install/dll-copy.js
+++ /dev/null
@@ -1,37 +0,0 @@
-'use strict';
-
-const fs = require('fs');
-const path = require('path');
-
-const libvips = require('../lib/libvips');
-
-const minimumLibvipsVersion = libvips.minimumLibvipsVersion;
-
-const platform = process.env.npm_config_platform || process.platform;
-if (platform === 'win32') {
- const buildDir = path.join(__dirname, '..', 'build');
- const buildReleaseDir = path.join(buildDir, 'Release');
- libvips.log(`Creating ${buildReleaseDir}`);
- try {
- libvips.mkdirSync(buildDir);
- libvips.mkdirSync(buildReleaseDir);
- } catch (err) {}
- const vendorLibDir = path.join(__dirname, '..', 'vendor', minimumLibvipsVersion, 'lib');
- libvips.log(`Copying DLLs from ${vendorLibDir} to ${buildReleaseDir}`);
- try {
- fs
- .readdirSync(vendorLibDir)
- .filter(function (filename) {
- return /\.dll$/.test(filename);
- })
- .forEach(function (filename) {
- fs.copyFileSync(
- path.join(vendorLibDir, filename),
- path.join(buildReleaseDir, filename)
- );
- });
- } catch (err) {
- libvips.log(err);
- process.exit(1);
- }
-}
diff --git a/install/libvips.js b/install/libvips.js
deleted file mode 100644
index 35f68fd10..000000000
--- a/install/libvips.js
+++ /dev/null
@@ -1,168 +0,0 @@
-'use strict';
-
-const fs = require('fs');
-const os = require('os');
-const path = require('path');
-const stream = require('stream');
-const zlib = require('zlib');
-
-const detectLibc = require('detect-libc');
-const semver = require('semver');
-const simpleGet = require('simple-get');
-const tarFs = require('tar-fs');
-
-const agent = require('../lib/agent');
-const libvips = require('../lib/libvips');
-const platform = require('../lib/platform');
-
-const minimumGlibcVersionByArch = {
- arm: '2.28',
- arm64: '2.29',
- x64: '2.17'
-};
-
-const hasSharpPrebuild = [
- 'darwin-x64',
- 'linux-arm64',
- 'linux-x64',
- 'linuxmusl-x64',
- 'linuxmusl-arm64',
- 'win32-ia32',
- 'win32-x64'
-];
-
-const { minimumLibvipsVersion, minimumLibvipsVersionLabelled } = libvips;
-const distHost = process.env.npm_config_sharp_libvips_binary_host || 'https://github.com/lovell/sharp-libvips/releases/download';
-const distBaseUrl = process.env.npm_config_sharp_dist_base_url || process.env.SHARP_DIST_BASE_URL || `${distHost}/v${minimumLibvipsVersionLabelled}/`;
-const supportsBrotli = ('BrotliDecompress' in zlib);
-
-const fail = function (err) {
- libvips.log(err);
- if (err.code === 'EACCES') {
- libvips.log('Are you trying to install as a root or sudo user? Try again with the --unsafe-perm flag');
- }
- libvips.log('Attempting to build from source via node-gyp but this may fail due to the above error');
- libvips.log('Please see https://sharp.pixelplumbing.com/install for required dependencies');
- process.exit(1);
-};
-
-const extractTarball = function (tarPath, platformAndArch) {
- const vendorPath = path.join(__dirname, '..', 'vendor');
- libvips.mkdirSync(vendorPath);
- const versionedVendorPath = path.join(vendorPath, minimumLibvipsVersion);
- libvips.mkdirSync(versionedVendorPath);
-
- const ignoreVendorInclude = hasSharpPrebuild.includes(platformAndArch) && !process.env.npm_config_build_from_source;
- const ignore = function (name) {
- return ignoreVendorInclude && name.includes('include/');
- };
-
- stream.pipeline(
- fs.createReadStream(tarPath),
- supportsBrotli ? new zlib.BrotliDecompress() : new zlib.Gunzip(),
- tarFs.extract(versionedVendorPath, { ignore }),
- function (err) {
- if (err) {
- if (/unexpected end of file/.test(err.message)) {
- fail(new Error(`Please delete ${tarPath} as it is not a valid tarball`));
- }
- fail(err);
- }
- }
- );
-};
-
-try {
- const useGlobalLibvips = libvips.useGlobalLibvips();
-
- if (useGlobalLibvips) {
- const globalLibvipsVersion = libvips.globalLibvipsVersion();
- libvips.log(`Detected globally-installed libvips v${globalLibvipsVersion}`);
- libvips.log('Building from source via node-gyp');
- process.exit(1);
- } else if (libvips.hasVendoredLibvips()) {
- libvips.log(`Using existing vendored libvips v${minimumLibvipsVersion}`);
- } else {
- // Is this arch/platform supported?
- const arch = process.env.npm_config_arch || process.arch;
- const platformAndArch = platform();
- if (arch === 'ia32' && !platformAndArch.startsWith('win32')) {
- throw new Error(`Intel Architecture 32-bit systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
- }
- if (platformAndArch === 'darwin-arm64') {
- throw new Error("Please run 'brew install vips' to install libvips on Apple M1 (ARM64) systems");
- }
- if (platformAndArch === 'freebsd-x64' || platformAndArch === 'openbsd-x64' || platformAndArch === 'sunos-x64') {
- throw new Error(`BSD/SunOS systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
- }
- if (detectLibc.family === detectLibc.GLIBC && detectLibc.version) {
- if (semver.lt(`${detectLibc.version}.0`, `${minimumGlibcVersionByArch[arch]}.0`)) {
- throw new Error(`Use with glibc ${detectLibc.version} requires manual installation of libvips >= ${minimumLibvipsVersion}`);
- }
- }
- if (detectLibc.family === detectLibc.MUSL && detectLibc.version) {
- if (semver.lt(detectLibc.version, '1.1.24')) {
- throw new Error(`Use with musl ${detectLibc.version} requires manual installation of libvips >= ${minimumLibvipsVersion}`);
- }
- }
-
- const supportedNodeVersion = process.env.npm_package_engines_node || require('../package.json').engines.node;
- if (!semver.satisfies(process.versions.node, supportedNodeVersion)) {
- throw new Error(`Expected Node.js version ${supportedNodeVersion} but found ${process.versions.node}`);
- }
-
- const extension = supportsBrotli ? 'br' : 'gz';
-
- // Download to per-process temporary file
- const tarFilename = ['libvips', minimumLibvipsVersion, platformAndArch].join('-') + '.tar.' + extension;
- const tarPathCache = path.join(libvips.cachePath(), tarFilename);
- if (fs.existsSync(tarPathCache)) {
- libvips.log(`Using cached ${tarPathCache}`);
- extractTarball(tarPathCache, platformAndArch);
- } else {
- const url = distBaseUrl + tarFilename;
- libvips.log(`Downloading ${url}`);
- simpleGet({ url: url, agent: agent() }, function (err, response) {
- if (err) {
- fail(err);
- } else if (response.statusCode === 404) {
- fail(new Error(`Prebuilt libvips ${minimumLibvipsVersion} binaries are not yet available for ${platformAndArch}`));
- } else if (response.statusCode !== 200) {
- fail(new Error(`Status ${response.statusCode} ${response.statusMessage}`));
- } else {
- const tarPathTemp = path.join(os.tmpdir(), `${process.pid}-${tarFilename}`);
- const tmpFileStream = fs.createWriteStream(tarPathTemp);
- response
- .on('error', function (err) {
- tmpFileStream.destroy(err);
- })
- .on('close', function () {
- if (!response.complete) {
- tmpFileStream.destroy(new Error('Download incomplete (connection was terminated)'));
- }
- })
- .pipe(tmpFileStream);
- tmpFileStream
- .on('error', function (err) {
- // Clean up temporary file
- fs.unlinkSync(tarPathTemp);
- fail(err);
- })
- .on('close', function () {
- try {
- // Attempt to rename
- fs.renameSync(tarPathTemp, tarPathCache);
- } catch (err) {
- // Fall back to copy and unlink
- fs.copyFileSync(tarPathTemp, tarPathCache);
- fs.unlinkSync(tarPathTemp);
- }
- extractTarball(tarPathCache);
- });
- }
- });
- }
- }
-} catch (err) {
- fail(err);
-}
diff --git a/lib/agent.js b/lib/agent.js
deleted file mode 100644
index 7ddb8fca6..000000000
--- a/lib/agent.js
+++ /dev/null
@@ -1,40 +0,0 @@
-'use strict';
-
-const url = require('url');
-const tunnelAgent = require('tunnel-agent');
-
-const is = require('./is');
-
-const proxies = [
- 'HTTPS_PROXY',
- 'https_proxy',
- 'HTTP_PROXY',
- 'http_proxy',
- 'npm_config_https_proxy',
- 'npm_config_proxy'
-];
-
-function env (key) {
- return process.env[key];
-}
-
-module.exports = function () {
- try {
- const proxy = new url.URL(proxies.map(env).find(is.string));
- const tunnel = proxy.protocol === 'https:'
- ? tunnelAgent.httpsOverHttps
- : tunnelAgent.httpsOverHttp;
- const proxyAuth = proxy.username && proxy.password
- ? `${proxy.username}:${proxy.password}`
- : null;
- return tunnel({
- proxy: {
- port: Number(proxy.port),
- host: proxy.hostname,
- proxyAuth
- }
- });
- } catch (err) {
- return null;
- }
-};
diff --git a/lib/channel.js b/lib/channel.js
index 1ca2fec20..3c6c0b439 100644
--- a/lib/channel.js
+++ b/lib/channel.js
@@ -1,4 +1,7 @@
-'use strict';
+/*!
+ Copyright 2013 Lovell Fuller and others.
+ SPDX-License-Identifier: Apache-2.0
+*/
const is = require('./is');
@@ -13,7 +16,9 @@ const bool = {
};
/**
- * Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel.
+ * Remove alpha channels, if any. This is a no-op if the image does not have an alpha channel.
+ *
+ * See also {@link /api-operation/#flatten flatten}.
*
* @example
* sharp('rgba.png')
@@ -30,35 +35,59 @@ function removeAlpha () {
}
/**
- * Ensure alpha channel, if missing. The added alpha channel will be fully opaque. This is a no-op if the image already has an alpha channel.
+ * Ensure the output image has an alpha transparency channel.
+ * If missing, the added alpha channel will have the specified
+ * transparency level, defaulting to fully-opaque (1).
+ * This is a no-op if the image already has an alpha channel.
*
* @since 0.21.2
*
* @example
- * sharp('rgb.jpg')
+ * // rgba.png will be a 4 channel image with a fully-opaque alpha channel
+ * await sharp('rgb.jpg')
* .ensureAlpha()
- * .toFile('rgba.png', function(err, info) {
- * // rgba.png is a 4 channel image with a fully opaque alpha channel
- * });
+ * .toFile('rgba.png')
*
+ * @example
+ * // rgba is a 4 channel image with a fully-transparent alpha channel
+ * const rgba = await sharp(rgb)
+ * .ensureAlpha(0)
+ * .toBuffer();
+ *
+ * @param {number} [alpha=1] - alpha transparency level (0=fully-transparent, 1=fully-opaque)
* @returns {Sharp}
+ * @throws {Error} Invalid alpha transparency level
*/
-function ensureAlpha () {
- this.options.ensureAlpha = true;
+function ensureAlpha (alpha) {
+ if (is.defined(alpha)) {
+ if (is.number(alpha) && is.inRange(alpha, 0, 1)) {
+ this.options.ensureAlpha = alpha;
+ } else {
+ throw is.invalidParameterError('alpha', 'number between 0 and 1', alpha);
+ }
+ } else {
+ this.options.ensureAlpha = 1;
+ }
return this;
}
/**
* Extract a single channel from a multi-channel image.
*
+ * The output colourspace will be either `b-w` (8-bit) or `grey16` (16-bit).
+ *
* @example
- * sharp(input)
+ * // green.jpg is a greyscale image containing the green channel of the input
+ * await sharp(input)
* .extractChannel('green')
- * .toColourspace('b-w')
- * .toFile('green.jpg', function(err, info) {
- * // info.channels === 1
- * // green.jpg is a greyscale image containing the green channel of the input
- * });
+ * .toFile('green.jpg');
+ *
+ * @example
+ * // red1 is the red value of the first pixel, red2 the second pixel etc.
+ * const [red1, red2, ...] = await sharp(input)
+ * .extractChannel(0)
+ * .raw()
+ * .toBuffer();
*
* @param {number|string} channel - zero-indexed channel/band number to extract, or `red`, `green`, `blue` or `alpha`.
* @returns {Sharp}
@@ -131,9 +160,10 @@ function bandbool (boolOp) {
/**
* Decorate the Sharp prototype with channel-related functions.
+ * @module Sharp
* @private
*/
-module.exports = function (Sharp) {
+module.exports = (Sharp) => {
Object.assign(Sharp.prototype, {
// Public instance functions
removeAlpha,
diff --git a/lib/colour.js b/lib/colour.js
index c4516c5a1..e61c248a8 100644
--- a/lib/colour.js
+++ b/lib/colour.js
@@ -1,6 +1,9 @@
-'use strict';
+/*!
+ Copyright 2013 Lovell Fuller and others.
+ SPDX-License-Identifier: Apache-2.0
+*/
-const color = require('color');
+const color = require('@img/colour');
const is = require('./is');
/**
@@ -16,27 +19,34 @@ const colourspace = {
};
/**
- * Tint the image using the provided chroma while preserving the image luminance.
+ * Tint the image using the provided colour.
* An alpha channel may be present and will be unchanged by the operation.
*
- * @param {string|Object} rgb - parsed by the [color](https://www.npmjs.org/package/color) module to extract chroma values.
+ * @example
+ * const output = await sharp(input)
+ * .tint({ r: 255, g: 240, b: 16 })
+ * .toBuffer();
+ *
+ * @param {string|Object} tint - Parsed by the [color](https://www.npmjs.org/package/color) module.
* @returns {Sharp}
* @throws {Error} Invalid parameter
*/
-function tint (rgb) {
- const colour = color(rgb);
- this.options.tintA = colour.a();
- this.options.tintB = colour.b();
+function tint (tint) {
+ this._setBackgroundColourOption('tint', tint);
return this;
}
/**
* Convert to 8-bit greyscale; 256 shades of grey.
* This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
- * By default the output image will be web-friendly sRGB and contain three (identical) color channels.
+ * By default the output image will be web-friendly sRGB and contain three (identical) colour channels.
* This may be overridden by other sharp operations such as `toColourspace('b-w')`,
- * which will produce an output image containing one color channel.
+ * which will produce an output image containing one colour channel.
* An alpha channel may be present, and will be unchanged by the operation.
+ *
+ * @example
+ * const output = await sharp(input).greyscale().toBuffer();
+ *
* @param {Boolean} [greyscale=true]
* @returns {Sharp}
*/
@@ -54,6 +64,44 @@ function grayscale (grayscale) {
return this.greyscale(grayscale);
}
+/**
+ * Set the pipeline colourspace.
+ *
+ * The input image will be converted to the provided colourspace at the start of the pipeline.
+ * All operations will use this colourspace before converting to the output colourspace,
+ * as defined by {@link #tocolourspace toColourspace}.
+ *
+ * @since 0.29.0
+ *
+ * @example
+ * // Run pipeline in 16 bits per channel RGB while converting final result to 8 bits per channel sRGB.
+ * await sharp(input)
+ * .pipelineColourspace('rgb16')
+ * .toColourspace('srgb')
+ * .toFile('16bpc-pipeline-to-8bpc-output.png')
+ *
+ * @param {string} [colourspace] - pipeline colourspace e.g. `rgb16`, `scrgb`, `lab`, `grey16` [...](https://www.libvips.org/API/current/enum.Interpretation.html)
+ * @returns {Sharp}
+ * @throws {Error} Invalid parameters
+ */
+function pipelineColourspace (colourspace) {
+ if (!is.string(colourspace)) {
+ throw is.invalidParameterError('colourspace', 'string', colourspace);
+ }
+ this.options.colourspacePipeline = colourspace;
+ return this;
+}
+
+/**
+ * Alternative spelling of `pipelineColourspace`.
+ * @param {string} [colorspace] - pipeline colorspace.
+ * @returns {Sharp}
+ * @throws {Error} Invalid parameters
+ */
+function pipelineColorspace (colorspace) {
+ return this.pipelineColourspace(colorspace);
+}
+
/**
* Set the output colourspace.
* By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
@@ -64,7 +112,7 @@ function grayscale (grayscale) {
* .toColourspace('rgb16')
* .toFile('16-bpp.png')
*
- * @param {string} [colourspace] - output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://github.com/libvips/libvips/blob/master/libvips/iofuncs/enumtypes.c#L568)
+ * @param {string} [colourspace] - output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://www.libvips.org/API/current/enum.Interpretation.html)
* @returns {Sharp}
* @throws {Error} Invalid parameters
*/
@@ -86,6 +134,29 @@ function toColorspace (colorspace) {
return this.toColourspace(colorspace);
}
+/**
+ * Create a RGBA colour array from a given value.
+ * @private
+ * @param {string|Object} value
+ * @throws {Error} Invalid value
+ */
+function _getBackgroundColourOption (value) {
+ if (
+ is.object(value) ||
+ (is.string(value) && value.length >= 3 && value.length <= 200)
+ ) {
+ const colour = color(value);
+ return [
+ colour.red(),
+ colour.green(),
+ colour.blue(),
+ Math.round(colour.alpha() * 255)
+ ];
+ } else {
+ throw is.invalidParameterError('background', 'object or string', value);
+ }
+}
+
/**
* Update a colour attribute of the this.options Object.
* @private
@@ -95,33 +166,27 @@ function toColorspace (colorspace) {
*/
function _setBackgroundColourOption (key, value) {
if (is.defined(value)) {
- if (is.object(value) || is.string(value)) {
- const colour = color(value);
- this.options[key] = [
- colour.red(),
- colour.green(),
- colour.blue(),
- Math.round(colour.alpha() * 255)
- ];
- } else {
- throw is.invalidParameterError('background', 'object or string', value);
- }
+ this.options[key] = _getBackgroundColourOption(value);
}
}
/**
* Decorate the Sharp prototype with colour-related functions.
+ * @module Sharp
* @private
*/
-module.exports = function (Sharp) {
+module.exports = (Sharp) => {
Object.assign(Sharp.prototype, {
// Public
tint,
greyscale,
grayscale,
+ pipelineColourspace,
+ pipelineColorspace,
toColourspace,
toColorspace,
// Private
+ _getBackgroundColourOption,
_setBackgroundColourOption
});
// Class attributes
diff --git a/lib/composite.js b/lib/composite.js
index 88ab83cbf..1c3e5e629 100644
--- a/lib/composite.js
+++ b/lib/composite.js
@@ -1,4 +1,7 @@
-'use strict';
+/*!
+ Copyright 2013 Lovell Fuller and others.
+ SPDX-License-Identifier: Apache-2.0
+*/
const is = require('./is');
@@ -43,6 +46,9 @@ const blend = {
* The images to composite must be the same size or smaller than the processed image.
* If both `top` and `left` options are provided, they take precedence over `gravity`.
*
+ * Other operations in the same processing pipeline (e.g. resize, rotate, flip,
+ * flop, extract) will always be applied to the input image before composition.
+ *
* The `blend` option can be one of `clear`, `source`, `over`, `in`, `out`, `atop`,
* `dest`, `dest-over`, `dest-in`, `dest-out`, `dest-atop`,
* `xor`, `add`, `saturate`, `multiply`, `screen`, `overlay`, `darken`, `lighten`,
@@ -50,12 +56,27 @@ const blend = {
* `hard-light`, `soft-light`, `difference`, `exclusion`.
*
* More information about blend modes can be found at
- * https://libvips.github.io/libvips/API/current/libvips-conversion.html#VipsBlendMode
+ * https://www.libvips.org/API/current/enum.BlendMode.html
* and https://www.cairographics.org/operators/
*
* @since 0.22.0
*
* @example
+ * await sharp(background)
+ * .composite([
+ * { input: layer1, gravity: 'northwest' },
+ * { input: layer2, gravity: 'southeast' },
+ * ])
+ * .toFile('combined.png');
+ *
+ * @example
+ * const output = await sharp('input.gif', { animated: true })
+ * .composite([
+ * { input: 'overlay.png', tile: true, blend: 'saturate' }
+ * ])
+ * .toBuffer();
+ *
+ * @example
* sharp('input.png')
* .rotate(180)
* .resize(300)
@@ -78,17 +99,32 @@ const blend = {
* @param {Number} [images[].input.create.height]
* @param {Number} [images[].input.create.channels] - 3-4
* @param {String|Object} [images[].input.create.background] - parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
+ * @param {Object} [images[].input.text] - describes a new text image to be created.
+ * @param {string} [images[].input.text.text] - text to render as a UTF-8 string. It can contain Pango markup, for example `LeMonde`.
+ * @param {string} [images[].input.text.font] - font name to render with.
+ * @param {string} [images[].input.text.fontfile] - absolute filesystem path to a font file that can be used by `font`.
+ * @param {number} [images[].input.text.width=0] - integral number of pixels to word-wrap at. Lines of text wider than this will be broken at word boundaries.
+ * @param {number} [images[].input.text.height=0] - integral number of pixels high. When defined, `dpi` will be ignored and the text will automatically fit the pixel resolution defined by `width` and `height`. Will be ignored if `width` is not specified or set to 0.
+ * @param {string} [images[].input.text.align='left'] - text alignment (`'left'`, `'centre'`, `'center'`, `'right'`).
+ * @param {boolean} [images[].input.text.justify=false] - set this to true to apply justification to the text.
+ * @param {number} [images[].input.text.dpi=72] - the resolution (size) at which to render the text. Does not take effect if `height` is specified.
+ * @param {boolean} [images[].input.text.rgba=false] - set this to true to enable RGBA output. This is useful for colour emoji rendering, or support for Pango markup features like `Red!`.
+ * @param {number} [images[].input.text.spacing=0] - text line height in points. Will use the font line height if none is specified.
+ * @param {Boolean} [images[].autoOrient=false] - set to true to use EXIF orientation data, if present, to orient the image.
* @param {String} [images[].blend='over'] - how to blend this image with the image below.
* @param {String} [images[].gravity='centre'] - gravity at which to place the overlay.
* @param {Number} [images[].top] - the pixel offset from the top edge.
* @param {Number} [images[].left] - the pixel offset from the left edge.
* @param {Boolean} [images[].tile=false] - set to true to repeat the overlay image across the entire image with the given `gravity`.
- * @param {Boolean} [images[].premultiplied=false] - set to true to avoid premultipling the image below. Equivalent to the `--premultiplied` vips option.
+ * @param {Boolean} [images[].premultiplied=false] - set to true to avoid premultiplying the image below. Equivalent to the `--premultiplied` vips option.
* @param {Number} [images[].density=72] - number representing the DPI for vector overlay image.
* @param {Object} [images[].raw] - describes overlay when using raw pixel data.
* @param {Number} [images[].raw.width]
* @param {Number} [images[].raw.height]
* @param {Number} [images[].raw.channels]
+ * @param {boolean} [images[].animated=false] - Set to `true` to read all frames/pages of an animated image.
+ * @param {string} [images[].failOn='warning'] - @see {@link /api-constructor/ constructor parameters}
+ * @param {number|boolean} [images[].limitInputPixels=268402689] - @see {@link /api-constructor/ constructor parameters}
* @returns {Sharp}
* @throws {Error} Invalid parameters
*/
@@ -160,7 +196,6 @@ function composite (images) {
throw is.invalidParameterError('premultiplied', 'boolean', image.premultiplied);
}
}
-
return composite;
});
return this;
@@ -168,9 +203,10 @@ function composite (images) {
/**
* Decorate the Sharp prototype with composite-related functions.
+ * @module Sharp
* @private
*/
-module.exports = function (Sharp) {
+module.exports = (Sharp) => {
Sharp.prototype.composite = composite;
Sharp.blend = blend;
};
diff --git a/lib/constructor.js b/lib/constructor.js
index 214f85a61..9aac8105c 100644
--- a/lib/constructor.js
+++ b/lib/constructor.js
@@ -1,50 +1,35 @@
-'use strict';
+/*!
+ Copyright 2013 Lovell Fuller and others.
+ SPDX-License-Identifier: Apache-2.0
+*/
-const util = require('util');
-const stream = require('stream');
+const util = require('node:util');
+const stream = require('node:stream');
const is = require('./is');
-require('./libvips').hasVendoredLibvips();
-
-/* istanbul ignore next */
-try {
- require('../build/Release/sharp.node');
-} catch (err) {
- // Bail early if bindings aren't available
- const help = ['', 'Something went wrong installing the "sharp" module', '', err.message, ''];
- if (/NODE_MODULE_VERSION/.test(err.message)) {
- help.push('- Ensure the version of Node.js used at install time matches that used at runtime');
- } else if (/invalid ELF header/.test(err.message)) {
- help.push(`- Ensure "${process.platform}" is used at install time as well as runtime`);
- } else if (/dylib/.test(err.message) && /Incompatible library version/.test(err.message)) {
- help.push('- Run "brew update && brew upgrade vips"');
- } else {
- help.push(
- '- Remove the "node_modules/sharp" directory then run',
- ' "npm install --ignore-scripts=false --verbose sharp" and look for errors'
- );
- }
- help.push(
- '- Consult the installation documentation at https://sharp.pixelplumbing.com/install',
- '- Search for this error at https://github.com/lovell/sharp/issues', ''
- );
- const error = help.join('\n');
- throw new Error(error);
-}
+require('./sharp');
// Use NODE_DEBUG=sharp to enable libvips warnings
const debuglog = util.debuglog('sharp');
+const queueListener = (queueLength) => {
+ Sharp.queue.emit('change', queueLength);
+};
+
/**
* Constructor factory to create an instance of `sharp`, to which further methods are chained.
*
- * JPEG, PNG, WebP, AVIF or TIFF format image data can be streamed out from this object.
+ * JPEG, PNG, WebP, GIF, AVIF or TIFF format image data can be streamed out from this object.
* When using Stream based output, derived attributes are available from the `info` event.
*
* Non-critical problems encountered during processing are emitted as `warning` events.
*
* Implements the [stream.Duplex](http://nodejs.org/api/stream.html#stream_class_stream_duplex) class.
*
+ * When loading more than one page/frame of an animated image,
+ * these are combined as a vertically-stacked "toilet roll" image
+ * where the overall height is the `pageHeight` multiplied by the number of `pages`.
+ *
* @constructs Sharp
*
* @emits Sharp#info
@@ -59,19 +44,21 @@ const debuglog = util.debuglog('sharp');
* });
*
* @example
- * // Read image data from readableStream,
+ * // Read image data from remote URL,
* // resize to 300 pixels wide,
* // emit an 'info' event with calculated dimensions
* // and finally write image data to writableStream
- * var transformer = sharp()
+ * const { body } = fetch('https://...');
+ * const readableStream = Readable.fromWeb(body);
+ * const transformer = sharp()
* .resize(300)
- * .on('info', function(info) {
- * console.log('Image height is ' + info.height);
+ * .on('info', ({ height }) => {
+ * console.log(`Image height is ${height}`);
* });
* readableStream.pipe(transformer).pipe(writableStream);
*
* @example
- * // Create a blank 300x200 PNG image of semi-transluent red pixels
+ * // Create a blank 300x200 PNG image of semi-translucent red pixels
* sharp({
* create: {
* width: 300,
@@ -117,40 +104,112 @@ const debuglog = util.debuglog('sharp');
* }
* }).toFile('noise.png');
*
- * @param {(Buffer|Uint8Array|Uint8ClampedArray|string)} [input] - if present, can be
- * a Buffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data, or
+ * @example
+ * // Generate an image from text
+ * await sharp({
+ * text: {
+ * text: 'Hello, world!',
+ * width: 400, // max width
+ * height: 300 // max height
+ * }
+ * }).toFile('text_bw.png');
+ *
+ * @example
+ * // Generate an rgba image from text using pango markup and font
+ * await sharp({
+ * text: {
+ * text: 'Red!blue',
+ * font: 'sans',
+ * rgba: true,
+ * dpi: 300
+ * }
+ * }).toFile('text_rgba.png');
+ *
+ * @example
+ * // Join four input images as a 2x2 grid with a 4 pixel gutter
+ * const data = await sharp(
+ * [image1, image2, image3, image4],
+ * { join: { across: 2, shim: 4 } }
+ * ).toBuffer();
+ *
+ * @example
+ * // Generate a two-frame animated image from emoji
+ * const images = ['😀', '😛'].map(text => ({
+ * text: { text, width: 64, height: 64, channels: 4, rgba: true }
+ * }));
+ * await sharp(images, { join: { animated: true } }).toFile('out.gif');
+ *
+ * @param {(Buffer|ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|Uint16Array|Int16Array|Uint32Array|Int32Array|Float32Array|Float64Array|string|Array)} [input] - if present, can be
+ * a Buffer / ArrayBuffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image data, or
+ * a TypedArray containing raw pixel image data, or
* a String containing the filesystem path to an JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image file.
+ * An array of inputs can be provided, and these will be joined together.
* JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present.
* @param {Object} [options] - if present, is an Object with optional attributes.
- * @param {boolean} [options.failOnError=true] - by default halt processing and raise an error when loading invalid images.
- * Set this flag to `false` if you'd rather apply a "best effort" to decode images, even if the data is corrupt or invalid.
+ * @param {string} [options.failOn='warning'] - When to abort processing of invalid pixel data, one of (in order of sensitivity, least to most): 'none', 'truncated', 'error', 'warning'. Higher levels imply lower levels. Invalid metadata will always abort.
* @param {number|boolean} [options.limitInputPixels=268402689] - Do not process input images where the number of pixels
* (width x height) exceeds this limit. Assumes image dimensions contained in the input metadata can be trusted.
* An integral Number of pixels, zero or false to remove limit, true to use default limit of 268402689 (0x3FFF x 0x3FFF).
- * @param {boolean} [options.sequentialRead=false] - Set this to `true` to use sequential rather than random access where possible.
- * This can reduce memory usage and might improve performance on some systems.
+ * @param {boolean} [options.unlimited=false] - Set this to `true` to remove safety features that help prevent memory exhaustion (JPEG, PNG, SVG, HEIF).
+ * @param {boolean} [options.autoOrient=false] - Set this to `true` to rotate/flip the image to match EXIF `Orientation`, if any.
+ * @param {boolean} [options.sequentialRead=true] - Set this to `false` to use random access rather than sequential read. Some operations will do this automatically.
* @param {number} [options.density=72] - number representing the DPI for vector images in the range 1 to 100000.
- * @param {number} [options.pages=1] - number of pages to extract for multi-page input (GIF, WebP, AVIF, TIFF, PDF), use -1 for all pages.
- * @param {number} [options.page=0] - page number to start extracting from for multi-page input (GIF, WebP, AVIF, TIFF, PDF), zero based.
- * @param {number} [options.level=0] - level to extract from a multi-level input (OpenSlide), zero based.
- * @param {boolean} [options.animated=false] - Set to `true` to read all frames/pages of an animated image (equivalent of setting `pages` to `-1`).
+ * @param {number} [options.ignoreIcc=false] - should the embedded ICC profile, if any, be ignored.
+ * @param {number} [options.pages=1] - Number of pages to extract for multi-page input (GIF, WebP, TIFF), use -1 for all pages.
+ * @param {number} [options.page=0] - Page number to start extracting from for multi-page input (GIF, WebP, TIFF), zero based.
+ * @param {boolean} [options.animated=false] - Set to `true` to read all frames/pages of an animated image (GIF, WebP, TIFF), equivalent of setting `pages` to `-1`.
* @param {Object} [options.raw] - describes raw pixel input image data. See `raw()` for pixel ordering.
* @param {number} [options.raw.width] - integral number of pixels wide.
* @param {number} [options.raw.height] - integral number of pixels high.
* @param {number} [options.raw.channels] - integral number of channels, between 1 and 4.
+ * @param {boolean} [options.raw.premultiplied] - specifies that the raw input has already been premultiplied, set to `true`
+ * to avoid sharp premultiplying the image. (optional, default `false`)
+ * @param {number} [options.raw.pageHeight] - The pixel height of each page/frame for animated images, must be an integral factor of `raw.height`.
* @param {Object} [options.create] - describes a new image to be created.
* @param {number} [options.create.width] - integral number of pixels wide.
* @param {number} [options.create.height] - integral number of pixels high.
* @param {number} [options.create.channels] - integral number of channels, either 3 (RGB) or 4 (RGBA).
* @param {string|Object} [options.create.background] - parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
+ * @param {number} [options.create.pageHeight] - The pixel height of each page/frame for animated images, must be an integral factor of `create.height`.
* @param {Object} [options.create.noise] - describes a noise to be created.
* @param {string} [options.create.noise.type] - type of generated noise, currently only `gaussian` is supported.
- * @param {number} [options.create.noise.mean] - mean of pixels in generated noise.
- * @param {number} [options.create.noise.sigma] - standard deviation of pixels in generated noise.
+ * @param {number} [options.create.noise.mean=128] - Mean value of pixels in the generated noise.
+ * @param {number} [options.create.noise.sigma=30] - Standard deviation of pixel values in the generated noise.
+ * @param {Object} [options.text] - describes a new text image to be created.
+ * @param {string} [options.text.text] - text to render as a UTF-8 string. It can contain Pango markup, for example `LeMonde`.
+ * @param {string} [options.text.font] - font name to render with.
+ * @param {string} [options.text.fontfile] - absolute filesystem path to a font file that can be used by `font`.
+ * @param {number} [options.text.width=0] - Integral number of pixels to word-wrap at. Lines of text wider than this will be broken at word boundaries.
+ * @param {number} [options.text.height=0] - Maximum integral number of pixels high. When defined, `dpi` will be ignored and the text will automatically fit the pixel resolution defined by `width` and `height`. Will be ignored if `width` is not specified or set to 0.
+ * @param {string} [options.text.align='left'] - Alignment style for multi-line text (`'left'`, `'centre'`, `'center'`, `'right'`).
+ * @param {boolean} [options.text.justify=false] - set this to true to apply justification to the text.
+ * @param {number} [options.text.dpi=72] - the resolution (size) at which to render the text. Does not take effect if `height` is specified.
+ * @param {boolean} [options.text.rgba=false] - set this to true to enable RGBA output. This is useful for colour emoji rendering, or support for pango markup features like `Red!`.
+ * @param {number} [options.text.spacing=0] - text line height in points. Will use the font line height if none is specified.
+ * @param {string} [options.text.wrap='word'] - word wrapping style when width is provided, one of: 'word', 'char', 'word-char' (prefer word, fallback to char) or 'none'.
+ * @param {Object} [options.join] - describes how an array of input images should be joined.
+ * @param {number} [options.join.across=1] - number of images to join horizontally.
+ * @param {boolean} [options.join.animated=false] - set this to `true` to join the images as an animated image.
+ * @param {number} [options.join.shim=0] - number of pixels to insert between joined images.
+ * @param {string|Object} [options.join.background] - parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
+ * @param {string} [options.join.halign='left'] - horizontal alignment style for images joined horizontally (`'left'`, `'centre'`, `'center'`, `'right'`).
+ * @param {string} [options.join.valign='top'] - vertical alignment style for images joined vertically (`'top'`, `'centre'`, `'center'`, `'bottom'`).
+ * @param {Object} [options.tiff] - Describes TIFF specific options.
+ * @param {number} [options.tiff.subifd=-1] - Sub Image File Directory to extract for OME-TIFF, defaults to main image.
+ * @param {Object} [options.svg] - Describes SVG specific options.
+ * @param {string} [options.svg.stylesheet] - Custom CSS for SVG input, applied with a User Origin during the CSS cascade.
+ * @param {boolean} [options.svg.highBitdepth=false] - Set to `true` to render SVG input at 32-bits per channel (128-bit) instead of 8-bits per channel (32-bit) RGBA.
+ * @param {Object} [options.pdf] - Describes PDF specific options. Requires the use of a globally-installed libvips compiled with support for PDFium, Poppler, ImageMagick or GraphicsMagick.
+ * @param {string|Object} [options.pdf.background] - Background colour to use when PDF is partially transparent. Parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
+ * @param {Object} [options.openSlide] - Describes OpenSlide specific options. Requires the use of a globally-installed libvips compiled with support for OpenSlide.
+ * @param {number} [options.openSlide.level=0] - Level to extract from a multi-level input, zero based.
+ * @param {Object} [options.jp2] - Describes JPEG 2000 specific options. Requires the use of a globally-installed libvips compiled with support for OpenJPEG.
+ * @param {boolean} [options.jp2.oneshot=false] - Set to `true` to decode tiled JPEG 2000 images in a single operation, improving compatibility.
* @returns {Sharp}
* @throws {Error} Invalid parameters
*/
const Sharp = function (input, options) {
+ // biome-ignore lint/complexity/noArguments: constructor factory
if (arguments.length === 1 && !is.defined(input)) {
throw new Error('Invalid input');
}
@@ -173,11 +232,11 @@ const Sharp = function (input, options) {
canvas: 'crop',
position: 0,
resizeBackground: [0, 0, 0, 255],
- useExifOrientation: false,
angle: 0,
rotationAngle: 0,
rotationBackground: [0, 0, 0, 255],
- rotateBeforePreExtract: false,
+ rotateBefore: false,
+ orientBefore: false,
flip: false,
flop: false,
extendTop: 0,
@@ -185,7 +244,9 @@ const Sharp = function (input, options) {
extendLeft: 0,
extendRight: 0,
extendBackground: [0, 0, 0, 255],
+ extendWith: 'background',
withoutEnlargement: false,
+ withoutReduction: false,
affineMatrix: [],
affineBackground: [0, 0, 0, 255],
affineIdx: 0,
@@ -196,42 +257,65 @@ const Sharp = function (input, options) {
kernel: 'lanczos3',
fastShrinkOnLoad: true,
// operations
- tintA: 128,
- tintB: 128,
+ tint: [-1, 0, 0, 0],
flatten: false,
flattenBackground: [0, 0, 0],
+ unflatten: false,
negate: false,
+ negateAlpha: true,
medianSize: 0,
blurSigma: 0,
+ precision: 'integer',
+ minAmpl: 0.2,
sharpenSigma: 0,
- sharpenFlat: 1,
- sharpenJagged: 2,
+ sharpenM1: 1,
+ sharpenM2: 2,
+ sharpenX1: 2,
+ sharpenY2: 10,
+ sharpenY3: 20,
threshold: 0,
thresholdGrayscale: true,
- trimThreshold: 0,
+ trimBackground: [],
+ trimThreshold: -1,
+ trimLineArt: false,
+ dilateWidth: 0,
+ erodeWidth: 0,
gamma: 0,
gammaOut: 0,
greyscale: false,
normalise: false,
+ normaliseLower: 1,
+ normaliseUpper: 99,
+ claheWidth: 0,
+ claheHeight: 0,
+ claheMaxSlope: 3,
brightness: 1,
saturation: 1,
hue: 0,
+ lightness: 0,
booleanBufferIn: null,
booleanFileIn: '',
joinChannelIn: [],
extractChannel: -1,
removeAlpha: false,
- ensureAlpha: false,
+ ensureAlpha: -1,
colourspace: 'srgb',
+ colourspacePipeline: 'last',
composite: [],
// output
fileOut: '',
formatOut: 'input',
streamOut: false,
- withMetadata: false,
+ keepMetadata: 0,
withMetadataOrientation: -1,
- withMetadataIcc: '',
+ withMetadataDensity: 0,
+ withIccProfile: '',
+ withExif: {},
+ withExifMerge: true,
+ withXmp: '',
resolveWithObject: false,
+ loop: -1,
+ delay: [],
// output format
jpegQuality: 80,
jpegProgressive: false,
@@ -246,29 +330,56 @@ const Sharp = function (input, options) {
pngAdaptiveFiltering: false,
pngPalette: false,
pngQuality: 100,
- pngColours: 256,
+ pngEffort: 7,
+ pngBitdepth: 8,
pngDither: 1,
+ jp2Quality: 80,
+ jp2TileHeight: 512,
+ jp2TileWidth: 512,
+ jp2Lossless: false,
+ jp2ChromaSubsampling: '4:4:4',
webpQuality: 80,
webpAlphaQuality: 100,
webpLossless: false,
webpNearLossless: false,
webpSmartSubsample: false,
- webpReductionEffort: 4,
+ webpSmartDeblock: false,
+ webpPreset: 'default',
+ webpEffort: 4,
+ webpMinSize: false,
+ webpMixed: false,
+ gifBitdepth: 8,
+ gifEffort: 7,
+ gifDither: 1,
+ gifInterFrameMaxError: 0,
+ gifInterPaletteMaxError: 3,
+ gifKeepDuplicateFrames: false,
+ gifReuse: true,
+ gifProgressive: false,
tiffQuality: 80,
tiffCompression: 'jpeg',
+ tiffBigtiff: false,
tiffPredictor: 'horizontal',
tiffPyramid: false,
+ tiffMiniswhite: false,
tiffBitdepth: 8,
tiffTile: false,
tiffTileHeight: 256,
tiffTileWidth: 256,
tiffXres: 1.0,
tiffYres: 1.0,
+ tiffResolutionUnit: 'inch',
heifQuality: 50,
heifLossless: false,
heifCompression: 'av1',
- heifSpeed: 5,
- heifChromaSubsampling: '4:2:0',
+ heifEffort: 4,
+ heifChromaSubsampling: '4:4:4',
+ heifBitdepth: 8,
+ jxlDistance: 1,
+ jxlDecodingTier: 0,
+ jxlEffort: 7,
+ jxlLossless: false,
+ rawDepth: 'uchar',
tileSize: 256,
tileOverlap: 0,
tileContainer: 'fs',
@@ -280,22 +391,24 @@ const Sharp = function (input, options) {
tileBackground: [255, 255, 255, 255],
tileCentre: false,
tileId: 'https://example.com/iiif',
- linearA: 1,
- linearB: 0,
+ tileBasename: '',
+ timeoutSeconds: 0,
+ linearA: [],
+ linearB: [],
+ pdfBackground: [255, 255, 255, 255],
// Function to notify of libvips warnings
debuglog: warning => {
this.emit('warning', warning);
debuglog(warning);
},
// Function to notify of queue length changes
- queueListener: function (queueLength) {
- Sharp.queue.emit('change', queueLength);
- }
+ queueListener
};
this.options.input = this._createInputDescriptor(input, options, { allowStream: true });
return this;
};
-util.inherits(Sharp, stream.Duplex);
+Object.setPrototypeOf(Sharp.prototype, stream.Duplex.prototype);
+Object.setPrototypeOf(Sharp, stream.Duplex);
/**
* Take a "snapshot" of the Sharp instance, returning a new instance.
@@ -315,9 +428,7 @@ util.inherits(Sharp, stream.Duplex);
* // Using Promises to know when the pipeline is complete
* const fs = require("fs");
* const got = require("got");
- * const sharpStream = sharp({
- * failOnError: false
- * });
+ * const sharpStream = sharp({ failOn: 'none' });
*
* const promises = [];
*
@@ -344,7 +455,7 @@ util.inherits(Sharp, stream.Duplex);
* .toFile("optimized-500.webp")
* );
*
- * // https://github.com/sindresorhus/got#gotstreamurl-options
+ * // https://github.com/sindresorhus/got/blob/main/documentation/3-streams.md
* got.stream("https://www.example.com/some-file.jpg").pipe(sharpStream);
*
* Promise.all(promises)
@@ -363,13 +474,16 @@ util.inherits(Sharp, stream.Duplex);
function clone () {
// Clone existing options
const clone = this.constructor.call();
- clone.options = Object.assign({}, this.options);
+ const { debuglog, queueListener, ...options } = this.options;
+ clone.options = structuredClone(options);
+ clone.options.debuglog = debuglog;
+ clone.options.queueListener = queueListener;
// Pass 'finish' event to clone for Stream-based input
if (this._isStreamInput()) {
this.on('finish', () => {
// Clone inherits input data
this._flattenBufferIn();
- clone.options.bufferIn = this.options.bufferIn;
+ clone.options.input.buffer = this.options.input.buffer;
clone.emit('finish');
});
}
@@ -379,6 +493,7 @@ Object.assign(Sharp.prototype, { clone });
/**
* Export constructor.
+ * @module Sharp
* @private
*/
module.exports = Sharp;
diff --git a/lib/index.d.ts b/lib/index.d.ts
new file mode 100644
index 000000000..13714c947
--- /dev/null
+++ b/lib/index.d.ts
@@ -0,0 +1,1971 @@
+/**
+ * Copyright 2017 François Nguyen and others.
+ *
+ * Billy Kwok
+ * Bradley Odell
+ * Espen Hovlandsdal
+ * Floris de Bijl
+ * François Nguyen
+ * Jamie Woodbury
+ * Wooseop Kim
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
+ * the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// SPDX-License-Identifier: MIT
+
+///
+
+import type { Duplex } from 'node:stream';
+
+//#region Constructor functions
+
+/**
+ * Creates a sharp instance from an image
+ * @param input Buffer containing JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data, or String containing the path to an JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image file.
+ * @param options Object with optional attributes.
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+declare function sharp(options?: sharp.SharpOptions): sharp.Sharp;
+declare function sharp(
+ input?: sharp.SharpInput | Array,
+ options?: sharp.SharpOptions,
+): sharp.Sharp;
+
+declare namespace sharp {
+ /** Object containing nested boolean values representing the available input and output formats/methods. */
+ const format: FormatEnum;
+
+ /** An Object containing the version numbers of sharp, libvips and its dependencies. */
+ const versions: {
+ aom?: string | undefined;
+ archive?: string | undefined;
+ cairo?: string | undefined;
+ cgif?: string | undefined;
+ exif?: string | undefined;
+ expat?: string | undefined;
+ ffi?: string | undefined;
+ fontconfig?: string | undefined;
+ freetype?: string | undefined;
+ fribidi?: string | undefined;
+ glib?: string | undefined;
+ harfbuzz?: string | undefined;
+ heif?: string | undefined;
+ highway?: string | undefined;
+ imagequant?: string | undefined;
+ lcms?: string | undefined;
+ mozjpeg?: string | undefined;
+ pango?: string | undefined;
+ pixman?: string | undefined;
+ png?: string | undefined;
+ "proxy-libintl"?: string | undefined;
+ rsvg?: string | undefined;
+ sharp: string;
+ spng?: string | undefined;
+ tiff?: string | undefined;
+ vips: string;
+ webp?: string | undefined;
+ xml?: string | undefined;
+ "zlib-ng"?: string | undefined;
+ };
+
+ /** An Object containing the available interpolators and their proper values */
+ const interpolators: Interpolators;
+
+ /** An EventEmitter that emits a change event when a task is either queued, waiting for libuv to provide a worker thread, complete */
+ const queue: NodeJS.EventEmitter;
+
+ //#endregion
+
+ //#region Utility functions
+
+ /**
+ * Gets or, when options are provided, sets the limits of libvips' operation cache.
+ * Existing entries in the cache will be trimmed after any change in limits.
+ * This method always returns cache statistics, useful for determining how much working memory is required for a particular task.
+ * @param options Object with the following attributes, or Boolean where true uses default cache settings and false removes all caching (optional, default true)
+ * @returns The cache results.
+ */
+ function cache(options?: boolean | CacheOptions): CacheResult;
+
+ /**
+ * Gets or sets the number of threads libvips' should create to process each image.
+ * The default value is the number of CPU cores. A value of 0 will reset to this default.
+ * The maximum number of images that can be processed in parallel is limited by libuv's UV_THREADPOOL_SIZE environment variable.
+ * @param concurrency The new concurrency value.
+ * @returns The current concurrency value.
+ */
+ function concurrency(concurrency?: number): number;
+
+ /**
+ * Provides access to internal task counters.
+ * @returns Object containing task counters
+ */
+ function counters(): SharpCounters;
+
+ /**
+ * Get and set use of SIMD vector unit instructions. Requires libvips to have been compiled with highway support.
+ * Improves the performance of resize, blur and sharpen operations by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
+ * @param enable enable or disable use of SIMD vector unit instructions
+ * @returns true if usage of SIMD vector unit instructions is enabled
+ */
+ function simd(enable?: boolean): boolean;
+
+ /**
+ * Block libvips operations at runtime.
+ *
+ * This is in addition to the `VIPS_BLOCK_UNTRUSTED` environment variable,
+ * which when set will block all "untrusted" operations.
+ *
+ * @since 0.32.4
+ *
+ * @example Block all TIFF input.
+ * sharp.block({
+ * operation: ['VipsForeignLoadTiff']
+ * });
+ *
+ * @param {Object} options
+ * @param {Array} options.operation - List of libvips low-level operation names to block.
+ */
+ function block(options: { operation: string[] }): void;
+
+ /**
+ * Unblock libvips operations at runtime.
+ *
+ * This is useful for defining a list of allowed operations.
+ *
+ * @since 0.32.4
+ *
+ * @example Block all input except WebP from the filesystem.
+ * sharp.block({
+ * operation: ['VipsForeignLoad']
+ * });
+ * sharp.unblock({
+ * operation: ['VipsForeignLoadWebpFile']
+ * });
+ *
+ * @example Block all input except JPEG and PNG from a Buffer or Stream.
+ * sharp.block({
+ * operation: ['VipsForeignLoad']
+ * });
+ * sharp.unblock({
+ * operation: ['VipsForeignLoadJpegBuffer', 'VipsForeignLoadPngBuffer']
+ * });
+ *
+ * @param {Object} options
+ * @param {Array} options.operation - List of libvips low-level operation names to unblock.
+ */
+ function unblock(options: { operation: string[] }): void;
+
+ //#endregion
+
+ const gravity: GravityEnum;
+ const strategy: StrategyEnum;
+ const kernel: KernelEnum;
+ const fit: FitEnum;
+ const bool: BoolEnum;
+
+ interface Sharp extends Duplex {
+ //#region Channel functions
+
+ /**
+ * Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel.
+ * @returns A sharp instance that can be used to chain operations
+ */
+ removeAlpha(): Sharp;
+
+ /**
+ * Ensure alpha channel, if missing. The added alpha channel will be fully opaque. This is a no-op if the image already has an alpha channel.
+ * @param alpha transparency level (0=fully-transparent, 1=fully-opaque) (optional, default 1).
+ * @returns A sharp instance that can be used to chain operations
+ */
+ ensureAlpha(alpha?: number): Sharp;
+
+ /**
+ * Extract a single channel from a multi-channel image.
+ * @param channel zero-indexed channel/band number to extract, or red, green, blue or alpha.
+ * @throws {Error} Invalid channel
+ * @returns A sharp instance that can be used to chain operations
+ */
+ extractChannel(channel: 0 | 1 | 2 | 3 | 'red' | 'green' | 'blue' | 'alpha'): Sharp;
+
+ /**
+ * Join one or more channels to the image. The meaning of the added channels depends on the output colourspace, set with toColourspace().
+ * By default the output image will be web-friendly sRGB, with additional channels interpreted as alpha channels. Channel ordering follows vips convention:
+ * - sRGB: 0: Red, 1: Green, 2: Blue, 3: Alpha.
+ * - CMYK: 0: Magenta, 1: Cyan, 2: Yellow, 3: Black, 4: Alpha.
+ *
+ * Buffers may be any of the image formats supported by sharp.
+ * For raw pixel input, the options object should contain a raw attribute, which follows the format of the attribute of the same name in the sharp() constructor.
+ * @param images one or more images (file paths, Buffers).
+ * @param options image options, see sharp() constructor.
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ joinChannel(images: string | Buffer | ArrayLike, options?: SharpOptions): Sharp;
+
+ /**
+ * Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.
+ * @param boolOp one of "and", "or" or "eor" to perform that bitwise operation, like the C logic operators &, | and ^ respectively.
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ bandbool(boolOp: keyof BoolEnum): Sharp;
+
+ //#endregion
+
+ //#region Color functions
+
+ /**
+ * Tint the image using the provided colour.
+ * An alpha channel may be present and will be unchanged by the operation.
+ * @param tint Parsed by the color module.
+ * @returns A sharp instance that can be used to chain operations
+ */
+ tint(tint: Colour | Color): Sharp;
+
+ /**
+ * Convert to 8-bit greyscale; 256 shades of grey.
+ * This is a linear operation.
+ * If the input image is in a non-linear colour space such as sRGB, use gamma() with greyscale() for the best results.
+ * By default the output image will be web-friendly sRGB and contain three (identical) colour channels.
+ * This may be overridden by other sharp operations such as toColourspace('b-w'), which will produce an output image containing one colour channel.
+ * An alpha channel may be present, and will be unchanged by the operation.
+ * @param greyscale true to enable and false to disable (defaults to true)
+ * @returns A sharp instance that can be used to chain operations
+ */
+ greyscale(greyscale?: boolean): Sharp;
+
+ /**
+ * Alternative spelling of greyscale().
+ * @param grayscale true to enable and false to disable (defaults to true)
+ * @returns A sharp instance that can be used to chain operations
+ */
+ grayscale(grayscale?: boolean): Sharp;
+
+ /**
+ * Set the pipeline colourspace.
+ * The input image will be converted to the provided colourspace at the start of the pipeline.
+ * All operations will use this colourspace before converting to the output colourspace, as defined by toColourspace.
+ * This feature is experimental and has not yet been fully-tested with all operations.
+ *
+ * @param colourspace pipeline colourspace e.g. rgb16, scrgb, lab, grey16 ...
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ pipelineColourspace(colourspace?: string): Sharp;
+
+ /**
+ * Alternative spelling of pipelineColourspace
+ * @param colorspace pipeline colourspace e.g. rgb16, scrgb, lab, grey16 ...
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ pipelineColorspace(colorspace?: string): Sharp;
+
+ /**
+ * Set the output colourspace.
+ * By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
+ * @param colourspace output colourspace e.g. srgb, rgb, cmyk, lab, b-w ...
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ toColourspace(colourspace?: string): Sharp;
+
+ /**
+ * Alternative spelling of toColourspace().
+ * @param colorspace output colorspace e.g. srgb, rgb, cmyk, lab, b-w ...
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ toColorspace(colorspace: string): Sharp;
+
+ //#endregion
+
+ //#region Composite functions
+
+ /**
+ * Composite image(s) over the processed (resized, extracted etc.) image.
+ *
+ * The images to composite must be the same size or smaller than the processed image.
+ * If both `top` and `left` options are provided, they take precedence over `gravity`.
+ * @param images - Ordered list of images to composite
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ composite(images: OverlayOptions[]): Sharp;
+
+ //#endregion
+
+ //#region Input functions
+
+ /**
+ * Take a "snapshot" of the Sharp instance, returning a new instance.
+ * Cloned instances inherit the input of their parent instance.
+ * This allows multiple output Streams and therefore multiple processing pipelines to share a single input Stream.
+ * @returns A sharp instance that can be used to chain operations
+ */
+ clone(): Sharp;
+
+ /**
+ * Fast access to (uncached) image metadata without decoding any compressed image data.
+ * @returns A sharp instance that can be used to chain operations
+ */
+ metadata(callback: (err: Error, metadata: Metadata) => void): Sharp;
+
+ /**
+ * Fast access to (uncached) image metadata without decoding any compressed image data.
+ * @returns A promise that resolves with a metadata object
+ */
+ metadata(): Promise;
+
+ /**
+ * Keep all metadata (EXIF, ICC, XMP, IPTC) from the input image in the output image.
+ * @returns A sharp instance that can be used to chain operations
+ */
+ keepMetadata(): Sharp;
+
+ /**
+ * Access to pixel-derived image statistics for every channel in the image.
+ * @returns A sharp instance that can be used to chain operations
+ */
+ stats(callback: (err: Error, stats: Stats) => void): Sharp;
+
+ /**
+ * Access to pixel-derived image statistics for every channel in the image.
+ * @returns A promise that resolves with a stats object
+ */
+ stats(): Promise;
+
+ //#endregion
+
+ //#region Operation functions
+
+ /**
+ * Rotate the output image by either an explicit angle
+ * or auto-orient based on the EXIF `Orientation` tag.
+ *
+ * If an angle is provided, it is converted to a valid positive degree rotation.
+ * For example, `-450` will produce a 270 degree rotation.
+ *
+ * When rotating by an angle other than a multiple of 90,
+ * the background colour can be provided with the `background` option.
+ *
+ * If no angle is provided, it is determined from the EXIF data.
+ * Mirroring is supported and may infer the use of a flip operation.
+ *
+ * The use of `rotate` without an angle will remove the EXIF `Orientation` tag, if any.
+ *
+ * Only one rotation can occur per pipeline (aside from an initial call without
+ * arguments to orient via EXIF data). Previous calls to `rotate` in the same
+ * pipeline will be ignored.
+ *
+ * Multi-page images can only be rotated by 180 degrees.
+ *
+ * Method order is important when rotating, resizing and/or extracting regions,
+ * for example `.rotate(x).extract(y)` will produce a different result to `.extract(y).rotate(x)`.
+ *
+ * @example
+ * const pipeline = sharp()
+ * .rotate()
+ * .resize(null, 200)
+ * .toBuffer(function (err, outputBuffer, info) {
+ * // outputBuffer contains 200px high JPEG image data,
+ * // auto-rotated using EXIF Orientation tag
+ * // info.width and info.height contain the dimensions of the resized image
+ * });
+ * readableStream.pipe(pipeline);
+ *
+ * @example
+ * const rotateThenResize = await sharp(input)
+ * .rotate(90)
+ * .resize({ width: 16, height: 8, fit: 'fill' })
+ * .toBuffer();
+ * const resizeThenRotate = await sharp(input)
+ * .resize({ width: 16, height: 8, fit: 'fill' })
+ * .rotate(90)
+ * .toBuffer();
+ *
+ * @param {number} [angle=auto] angle of rotation.
+ * @param {Object} [options] - if present, is an Object with optional attributes.
+ * @param {string|Object} [options.background="#000000"] parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
+ * @returns {Sharp}
+ * @throws {Error} Invalid parameters
+ */
+ rotate(angle?: number, options?: RotateOptions): Sharp;
+
+ /**
+ * Alias for calling `rotate()` with no arguments, which orients the image based
+ * on EXIF orientsion.
+ *
+ * This operation is aliased to emphasize its purpose, helping to remove any
+ * confusion between rotation and orientation.
+ *
+ * @example
+ * const output = await sharp(input).autoOrient().toBuffer();
+ *
+ * @returns {Sharp}
+ */
+ autoOrient(): Sharp
+
+ /**
+ * Flip the image about the vertical Y axis. This always occurs after rotation, if any.
+ * The use of flip implies the removal of the EXIF Orientation tag, if any.
+ * @param flip true to enable and false to disable (defaults to true)
+ * @returns A sharp instance that can be used to chain operations
+ */
+ flip(flip?: boolean): Sharp;
+
+ /**
+ * Flop the image about the horizontal X axis. This always occurs after rotation, if any.
+ * The use of flop implies the removal of the EXIF Orientation tag, if any.
+ * @param flop true to enable and false to disable (defaults to true)
+ * @returns A sharp instance that can be used to chain operations
+ */
+ flop(flop?: boolean): Sharp;
+
+ /**
+ * Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
+ * You must provide an array of length 4 or a 2x2 affine transformation matrix.
+ * By default, new pixels are filled with a black background. You can provide a background colour with the `background` option.
+ * A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
+ *
+ * In the case of a 2x2 matrix, the transform is:
+ * X = matrix[0, 0] * (x + idx) + matrix[0, 1] * (y + idy) + odx
+ * Y = matrix[1, 0] * (x + idx) + matrix[1, 1] * (y + idy) + ody
+ *
+ * where:
+ *
+ * x and y are the coordinates in input image.
+ * X and Y are the coordinates in output image.
+ * (0,0) is the upper left corner.
+ *
+ * @param matrix Affine transformation matrix, may either by a array of length four or a 2x2 matrix array
+ * @param options if present, is an Object with optional attributes.
+ *
+ * @returns A sharp instance that can be used to chain operations
+ */
+ affine(matrix: [number, number, number, number] | Matrix2x2, options?: AffineOptions): Sharp;
+
+ /**
+ * Sharpen the image.
+ * When used without parameters, performs a fast, mild sharpen of the output image.
+ * When a sigma is provided, performs a slower, more accurate sharpen of the L channel in the LAB colour space.
+ * Fine-grained control over the level of sharpening in "flat" (m1) and "jagged" (m2) areas is available.
+ * @param options if present, is an Object with optional attributes
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ sharpen(options?: SharpenOptions): Sharp;
+
+ /**
+ * Sharpen the image.
+ * When used without parameters, performs a fast, mild sharpen of the output image.
+ * When a sigma is provided, performs a slower, more accurate sharpen of the L channel in the LAB colour space.
+ * Fine-grained control over the level of sharpening in "flat" (m1) and "jagged" (m2) areas is available.
+ * @param sigma the sigma of the Gaussian mask, where sigma = 1 + radius / 2.
+ * @param flat the level of sharpening to apply to "flat" areas. (optional, default 1.0)
+ * @param jagged the level of sharpening to apply to "jagged" areas. (optional, default 2.0)
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ *
+ * @deprecated Use the object parameter `sharpen({sigma, m1, m2, x1, y2, y3})` instead
+ */
+ sharpen(sigma?: number, flat?: number, jagged?: number): Sharp;
+
+ /**
+ * Apply median filter. When used without parameters the default window is 3x3.
+ * @param size square mask size: size x size (optional, default 3)
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ median(size?: number): Sharp;
+
+ /**
+ * Blur the image.
+ * When used without parameters, performs a fast, mild blur of the output image.
+ * When a sigma is provided, performs a slower, more accurate Gaussian blur.
+ * When a boolean sigma is provided, ether blur mild or disable blur
+ * @param sigma a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where sigma = 1 + radius / 2.
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ blur(sigma?: number | boolean | BlurOptions): Sharp;
+
+ /**
+ * Expand foreground objects using the dilate morphological operator.
+ * @param {Number} [width=1] dilation width in pixels.
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ dilate(width?: number): Sharp;
+
+ /**
+ * Shrink foreground objects using the erode morphological operator.
+ * @param {Number} [width=1] erosion width in pixels.
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ erode(width?: number): Sharp;
+
+ /**
+ * Merge alpha transparency channel, if any, with background.
+ * @param flatten true to enable and false to disable (defaults to true)
+ * @returns A sharp instance that can be used to chain operations
+ */
+ flatten(flatten?: boolean | FlattenOptions): Sharp;
+
+ /**
+ * Ensure the image has an alpha channel with all white pixel values made fully transparent.
+ * Existing alpha channel values for non-white pixels remain unchanged.
+ * @returns A sharp instance that can be used to chain operations
+ */
+ unflatten(): Sharp;
+
+ /**
+ * Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of 1/gamma then increasing the encoding (brighten) post-resize at a factor of gamma.
+ * This can improve the perceived brightness of a resized image in non-linear colour spaces.
+ * JPEG and WebP input images will not take advantage of the shrink-on-load performance optimisation when applying a gamma correction.
+ * Supply a second argument to use a different output gamma value, otherwise the first value is used in both cases.
+ * @param gamma value between 1.0 and 3.0. (optional, default 2.2)
+ * @param gammaOut value between 1.0 and 3.0. (optional, defaults to same as gamma)
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ gamma(gamma?: number, gammaOut?: number): Sharp;
+
+ /**
+ * Produce the "negative" of the image.
+ * @param negate true to enable and false to disable, or an object of options (defaults to true)
+ * @returns A sharp instance that can be used to chain operations
+ */
+ negate(negate?: boolean | NegateOptions): Sharp;
+
+ /**
+ * Enhance output image contrast by stretching its luminance to cover a full dynamic range.
+ *
+ * Uses a histogram-based approach, taking a default range of 1% to 99% to reduce sensitivity to noise at the extremes.
+ *
+ * Luminance values below the `lower` percentile will be underexposed by clipping to zero.
+ * Luminance values above the `upper` percentile will be overexposed by clipping to the max pixel value.
+ *
+ * @param normalise options
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ normalise(normalise?: NormaliseOptions): Sharp;
+
+ /**
+ * Alternative spelling of normalise.
+ * @param normalize options
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ normalize(normalize?: NormaliseOptions): Sharp;
+
+ /**
+ * Perform contrast limiting adaptive histogram equalization (CLAHE)
+ *
+ * This will, in general, enhance the clarity of the image by bringing out
+ * darker details. Please read more about CLAHE here:
+ * https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE
+ *
+ * @param options clahe options
+ */
+ clahe(options: ClaheOptions): Sharp;
+
+ /**
+ * Convolve the image with the specified kernel.
+ * @param kernel the specified kernel
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ convolve(kernel: Kernel): Sharp;
+
+ /**
+ * Any pixel value greather than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
+ * @param threshold a value in the range 0-255 representing the level at which the threshold will be applied. (optional, default 128)
+ * @param options threshold options
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ threshold(threshold?: number, options?: ThresholdOptions): Sharp;
+
+ /**
+ * Perform a bitwise boolean operation with operand image.
+ * This operation creates an output image where each pixel is the result of the selected bitwise boolean operation between the corresponding pixels of the input images.
+ * @param operand Buffer containing image data or String containing the path to an image file.
+ * @param operator one of "and", "or" or "eor" to perform that bitwise operation, like the C logic operators &, | and ^ respectively.
+ * @param options describes operand when using raw pixel data.
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ boolean(operand: string | Buffer, operator: keyof BoolEnum, options?: { raw: Raw }): Sharp;
+
+ /**
+ * Apply the linear formula a * input + b to the image (levels adjustment)
+ * @param a multiplier (optional, default 1.0)
+ * @param b offset (optional, default 0.0)
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ linear(a?: number | number[] | null, b?: number | number[]): Sharp;
+
+ /**
+ * Recomb the image with the specified matrix.
+ * @param inputMatrix 3x3 Recombination matrix or 4x4 Recombination matrix
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ recomb(inputMatrix: Matrix3x3 | Matrix4x4): Sharp;
+
+ /**
+ * Transforms the image using brightness, saturation, hue rotation and lightness.
+ * Brightness and lightness both operate on luminance, with the difference being that brightness is multiplicative whereas lightness is additive.
+ * @param options describes the modulation
+ * @returns A sharp instance that can be used to chain operations
+ */
+ modulate(options?: {
+ brightness?: number | undefined;
+ saturation?: number | undefined;
+ hue?: number | undefined;
+ lightness?: number | undefined;
+ }): Sharp;
+
+ //#endregion
+
+ //#region Output functions
+
+ /**
+ * Write output image data to a file.
+ * If an explicit output format is not selected, it will be inferred from the extension, with JPEG, PNG, WebP, AVIF, TIFF, DZI, and libvips' V format supported.
+ * Note that raw pixel data is only supported for buffer output.
+ * @param fileOut The path to write the image data to.
+ * @param callback Callback function called on completion with two arguments (err, info). info contains the output image format, size (bytes), width, height and channels.
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ toFile(fileOut: string, callback: (err: Error, info: OutputInfo) => void): Sharp;
+
+ /**
+ * Write output image data to a file.
+ * @param fileOut The path to write the image data to.
+ * @throws {Error} Invalid parameters
+ * @returns A promise that fulfills with an object containing information on the resulting file
+ */
+ toFile(fileOut: string): Promise;
+
+ /**
+ * Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
+ * By default, the format will match the input image, except SVG input which becomes PNG output.
+ * @param callback Callback function called on completion with three arguments (err, buffer, info).
+ * @returns A sharp instance that can be used to chain operations
+ */
+ toBuffer(callback: (err: Error, buffer: Buffer, info: OutputInfo) => void): Sharp;
+
+ /**
+ * Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
+ * By default, the format will match the input image, except SVG input which becomes PNG output.
+ * @param options resolve options
+ * @param options.resolveWithObject Resolve the Promise with an Object containing data and info properties instead of resolving only with data.
+ * @returns A promise that resolves with the Buffer data.
+ */
+ toBuffer(options?: { resolveWithObject: false }): Promise;
+
+ /**
+ * Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
+ * By default, the format will match the input image, except SVG input which becomes PNG output.
+ * @param options resolve options
+ * @param options.resolveWithObject Resolve the Promise with an Object containing data and info properties instead of resolving only with data.
+ * @returns A promise that resolves with an object containing the Buffer data and an info object containing the output image format, size (bytes), width, height and channels
+ */
+ toBuffer(options: { resolveWithObject: true }): Promise<{ data: Buffer; info: OutputInfo }>;
+
+ /**
+ * Keep all EXIF metadata from the input image in the output image.
+ * EXIF metadata is unsupported for TIFF output.
+ * @returns A sharp instance that can be used to chain operations
+ */
+ keepExif(): Sharp;
+
+ /**
+ * Set EXIF metadata in the output image, ignoring any EXIF in the input image.
+ * @param {Exif} exif Object keyed by IFD0, IFD1 etc. of key/value string pairs to write as EXIF data.
+ * @returns A sharp instance that can be used to chain operations
+ * @throws {Error} Invalid parameters
+ */
+ withExif(exif: Exif): Sharp;
+
+ /**
+ * Update EXIF metadata from the input image in the output image.
+ * @param {Exif} exif Object keyed by IFD0, IFD1 etc. of key/value string pairs to write as EXIF data.
+ * @returns A sharp instance that can be used to chain operations
+ * @throws {Error} Invalid parameters
+ */
+ withExifMerge(exif: Exif): Sharp;
+
+ /**
+ * Keep ICC profile from the input image in the output image where possible.
+ * @returns A sharp instance that can be used to chain operations
+ */
+ keepIccProfile(): Sharp;
+
+ /**
+ * Transform using an ICC profile and attach to the output image.
+ * @param {string} icc - Absolute filesystem path to output ICC profile or built-in profile name (srgb, p3, cmyk).
+ * @returns A sharp instance that can be used to chain operations
+ * @throws {Error} Invalid parameters
+ */
+ withIccProfile(icc: string, options?: WithIccProfileOptions): Sharp;
+
+ /**
+ * Keep all XMP metadata from the input image in the output image.
+ * @returns A sharp instance that can be used to chain operations
+ */
+ keepXmp(): Sharp;
+
+ /**
+ * Set XMP metadata in the output image.
+ * @param {string} xmp - String containing XMP metadata to be embedded in the output image.
+ * @returns A sharp instance that can be used to chain operations
+ * @throws {Error} Invalid parameters
+ */
+ withXmp(xmp: string): Sharp;
+
+ /**
+ * Include all metadata (EXIF, XMP, IPTC) from the input image in the output image.
+ * The default behaviour, when withMetadata is not used, is to strip all metadata and convert to the device-independent sRGB colour space.
+ * This will also convert to and add a web-friendly sRGB ICC profile.
+ * @param withMetadata
+ * @throws {Error} Invalid parameters.
+ */
+ withMetadata(withMetadata?: WriteableMetadata): Sharp;
+
+ /**
+ * Use these JPEG options for output image.
+ * @param options Output options.
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ jpeg(options?: JpegOptions): Sharp;
+
+ /**
+ * Use these JP2 (JPEG 2000) options for output image.
+ * @param options Output options.
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ jp2(options?: Jp2Options): Sharp;
+
+ /**
+ * Use these JPEG-XL (JXL) options for output image.
+ * This feature is experimental, please do not use in production systems.
+ * Requires libvips compiled with support for libjxl.
+ * The prebuilt binaries do not include this.
+ * Image metadata (EXIF, XMP) is unsupported.
+ * @param options Output options.
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ jxl(options?: JxlOptions): Sharp;
+
+ /**
+ * Use these PNG options for output image.
+ * PNG output is always full colour at 8 or 16 bits per pixel.
+ * Indexed PNG input at 1, 2 or 4 bits per pixel is converted to 8 bits per pixel.
+ * @param options Output options.
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ png(options?: PngOptions): Sharp;
+
+ /**
+ * Use these WebP options for output image.
+ * @param options Output options.
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ webp(options?: WebpOptions): Sharp;
+
+ /**
+ * Use these GIF options for output image.
+ * Requires libvips compiled with support for ImageMagick or GraphicsMagick. The prebuilt binaries do not include this - see installing a custom libvips.
+ * @param options Output options.
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ gif(options?: GifOptions): Sharp;
+
+ /**
+ * Use these AVIF options for output image.
+ * @param options Output options.
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ avif(options?: AvifOptions): Sharp;
+
+ /**
+ * Use these HEIF options for output image.
+ * Support for patent-encumbered HEIC images requires the use of a globally-installed libvips compiled with support for libheif, libde265 and x265.
+ * @param options Output options.
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ heif(options?: HeifOptions): Sharp;
+
+ /**
+ * Use these TIFF options for output image.
+ * @param options Output options.
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ tiff(options?: TiffOptions): Sharp;
+
+ /**
+ * Force output to be raw, uncompressed uint8 pixel data.
+ * @param options Raw output options.
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ raw(options?: RawOptions): Sharp;
+
+ /**
+ * Force output to a given format.
+ * @param format a String or an Object with an 'id' attribute
+ * @param options output options
+ * @throws {Error} Unsupported format or options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ toFormat(
+ format: keyof FormatEnum | AvailableFormatInfo,
+ options?:
+ | OutputOptions
+ | JpegOptions
+ | PngOptions
+ | WebpOptions
+ | AvifOptions
+ | HeifOptions
+ | JxlOptions
+ | GifOptions
+ | Jp2Options
+ | RawOptions
+ | TiffOptions,
+ ): Sharp;
+
+ /**
+ * Use tile-based deep zoom (image pyramid) output.
+ * Set the format and options for tile images via the toFormat, jpeg, png or webp functions.
+ * Use a .zip or .szi file extension with toFile to write to a compressed archive file format.
+ * @param tile tile options
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ tile(tile?: TileOptions): Sharp;
+
+ /**
+ * Set a timeout for processing, in seconds. Use a value of zero to continue processing indefinitely, the default behaviour.
+ * The clock starts when libvips opens an input image for processing. Time spent waiting for a libuv thread to become available is not included.
+ * @param options Object with a `seconds` attribute between 0 and 3600 (number)
+ * @throws {Error} Invalid options
+ * @returns A sharp instance that can be used to chain operations
+ */
+ timeout(options: TimeoutOptions): Sharp;
+
+ //#endregion
+
+ //#region Resize functions
+
+ /**
+ * Resize image to width, height or width x height.
+ *
+ * When both a width and height are provided, the possible methods by which the image should fit these are:
+ * - cover: Crop to cover both provided dimensions (the default).
+ * - contain: Embed within both provided dimensions.
+ * - fill: Ignore the aspect ratio of the input and stretch to both provided dimensions.
+ * - inside: Preserving aspect ratio, resize the image to be as large as possible while ensuring its dimensions are less than or equal to both those specified.
+ * - outside: Preserving aspect ratio, resize the image to be as small as possible while ensuring its dimensions are greater than or equal to both those specified.
+ * Some of these values are based on the object-fit CSS property.
+ *
+ * When using a fit of cover or contain, the default position is centre. Other options are:
+ * - sharp.position: top, right top, right, right bottom, bottom, left bottom, left, left top.
+ * - sharp.gravity: north, northeast, east, southeast, south, southwest, west, northwest, center or centre.
+ * - sharp.strategy: cover only, dynamically crop using either the entropy or attention strategy. Some of these values are based on the object-position CSS property.
+ *
+ * The experimental strategy-based approach resizes so one dimension is at its target length then repeatedly ranks edge regions,
+ * discarding the edge with the lowest score based on the selected strategy.
+ * - entropy: focus on the region with the highest Shannon entropy.
+ * - attention: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.
+ *
+ * Possible interpolation kernels are:
+ * - nearest: Use nearest neighbour interpolation.
+ * - cubic: Use a Catmull-Rom spline.
+ * - lanczos2: Use a Lanczos kernel with a=2.
+ * - lanczos3: Use a Lanczos kernel with a=3 (the default).
+ *
+ * @param width pixels wide the resultant image should be. Use null or undefined to auto-scale the width to match the height.
+ * @param height pixels high the resultant image should be. Use null or undefined to auto-scale the height to match the width.
+ * @param options resize options
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ resize(widthOrOptions?: number | ResizeOptions | null, height?: number | null, options?: ResizeOptions): Sharp;
+
+ /**
+ * Shorthand for resize(null, null, options);
+ *
+ * @param options resize options
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ resize(options: ResizeOptions): Sharp;
+
+ /**
+ * Extend / pad / extrude one or more edges of the image with either
+ * the provided background colour or pixels derived from the image.
+ * This operation will always occur after resizing and extraction, if any.
+ * @param extend single pixel count to add to all edges or an Object with per-edge counts
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ extend(extend: number | ExtendOptions): Sharp;
+
+ /**
+ * Extract a region of the image.
+ * - Use extract() before resize() for pre-resize extraction.
+ * - Use extract() after resize() for post-resize extraction.
+ * - Use extract() before and after for both.
+ *
+ * @param region The region to extract
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ extract(region: Region): Sharp;
+
+ /**
+ * Trim pixels from all edges that contain values similar to the given background colour, which defaults to that of the top-left pixel.
+ * Images with an alpha channel will use the combined bounding box of alpha and non-alpha channels.
+ * The info response Object will contain trimOffsetLeft and trimOffsetTop properties.
+ * @param options trim options
+ * @throws {Error} Invalid parameters
+ * @returns A sharp instance that can be used to chain operations
+ */
+ trim(options?: TrimOptions): Sharp;
+
+ //#endregion
+ }
+
+ type SharpInput = Buffer
+ | ArrayBuffer
+ | Uint8Array
+ | Uint8ClampedArray
+ | Int8Array
+ | Uint16Array
+ | Int16Array
+ | Uint32Array
+ | Int32Array
+ | Float32Array
+ | Float64Array
+ | string;
+
+ interface SharpOptions {
+ /**
+ * Auto-orient based on the EXIF `Orientation` tag, if present.
+ * Mirroring is supported and may infer the use of a flip operation.
+ *
+ * Using this option will remove the EXIF `Orientation` tag, if any.
+ */
+ autoOrient?: boolean | undefined;
+ /**
+ * When to abort processing of invalid pixel data, one of (in order of sensitivity):
+ * 'none' (least), 'truncated', 'error' or 'warning' (most), highers level imply lower levels, invalid metadata will always abort. (optional, default 'warning')
+ */
+ failOn?: FailOnOptions | undefined;
+ /**
+ * By default halt processing and raise an error when loading invalid images.
+ * Set this flag to false if you'd rather apply a "best effort" to decode images,
+ * even if the data is corrupt or invalid. (optional, default true)
+ *
+ * @deprecated Use `failOn` instead
+ */
+ failOnError?: boolean | undefined;
+ /**
+ * Do not process input images where the number of pixels (width x height) exceeds this limit.
+ * Assumes image dimensions contained in the input metadata can be trusted.
+ * An integral Number of pixels, zero or false to remove limit, true to use default limit of 268402689 (0x3FFF x 0x3FFF). (optional, default 268402689)
+ */
+ limitInputPixels?: number | boolean | undefined;
+ /** Set this to true to remove safety features that help prevent memory exhaustion (SVG, PNG). (optional, default false) */
+ unlimited?: boolean | undefined;
+ /** Set this to false to use random access rather than sequential read. Some operations will do this automatically. */
+ sequentialRead?: boolean | undefined;
+ /** Number representing the DPI for vector images in the range 1 to 100000. (optional, default 72) */
+ density?: number | undefined;
+ /** Should the embedded ICC profile, if any, be ignored. */
+ ignoreIcc?: boolean | undefined;
+ /** Number of pages to extract for multi-page input (GIF, TIFF, PDF), use -1 for all pages */
+ pages?: number | undefined;
+ /** Page number to start extracting from for multi-page input (GIF, TIFF, PDF), zero based. (optional, default 0) */
+ page?: number | undefined;
+ /** TIFF specific input options */
+ tiff?: TiffInputOptions | undefined;
+ /** SVG specific input options */
+ svg?: SvgInputOptions | undefined;
+ /** PDF specific input options */
+ pdf?: PdfInputOptions | undefined;
+ /** OpenSlide specific input options */
+ openSlide?: OpenSlideInputOptions | undefined;
+ /** JPEG 2000 specific input options */
+ jp2?: Jp2InputOptions | undefined;
+ /** @deprecated Use {@link SharpOptions.tiff} instead */
+ subifd?: number | undefined;
+ /** @deprecated Use {@link SharpOptions.pdf} instead */
+ pdfBackground?: Colour | Color | undefined;
+ /** @deprecated Use {@link SharpOptions.openSlide} instead */
+ level?: number | undefined;
+ /** Set to `true` to read all frames/pages of an animated image (equivalent of setting `pages` to `-1`). (optional, default false) */
+ animated?: boolean | undefined;
+ /** Describes raw pixel input image data. See raw() for pixel ordering. */
+ raw?: CreateRaw | undefined;
+ /** Describes a new image to be created. */
+ create?: Create | undefined;
+ /** Describes a new text image to be created. */
+ text?: CreateText | undefined;
+ /** Describes how array of input images should be joined. */
+ join?: Join | undefined;
+ }
+
+ interface CacheOptions {
+ /** Is the maximum memory in MB to use for this cache (optional, default 50) */
+ memory?: number | undefined;
+ /** Is the maximum number of files to hold open (optional, default 20) */
+ files?: number | undefined;
+ /** Is the maximum number of operations to cache (optional, default 100) */
+ items?: number | undefined;
+ }
+
+ interface TimeoutOptions {
+ /** Number of seconds after which processing will be stopped (default 0, eg disabled) */
+ seconds: number;
+ }
+
+ interface SharpCounters {
+ /** The number of tasks this module has queued waiting for libuv to provide a worker thread from its pool. */
+ queue: number;
+ /** The number of resize tasks currently being processed. */
+ process: number;
+ }
+
+ interface Raw {
+ width: number;
+ height: number;
+ channels: Channels;
+ }
+
+ interface CreateRaw extends Raw {
+ /** Specifies that the raw input has already been premultiplied, set to true to avoid sharp premultiplying the image. (optional, default false) */
+ premultiplied?: boolean | undefined;
+ /** The height of each page/frame for animated images, must be an integral factor of the overall image height. */
+ pageHeight?: number | undefined;
+ }
+
+ type CreateChannels = 3 | 4;
+
+ interface Create {
+ /** Number of pixels wide. */
+ width: number;
+ /** Number of pixels high. */
+ height: number;
+ /** Number of bands, 3 for RGB, 4 for RGBA */
+ channels: CreateChannels;
+ /** Parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. */
+ background: Colour | Color;
+ /** Describes a noise to be created. */
+ noise?: Noise | undefined;
+ /** The height of each page/frame for animated images, must be an integral factor of the overall image height. */
+ pageHeight?: number | undefined;
+
+ }
+
+ interface CreateText {
+ /** Text to render as a UTF-8 string. It can contain Pango markup, for example `LeMonde`. */
+ text: string;
+ /** Font name to render with. */
+ font?: string;
+ /** Absolute filesystem path to a font file that can be used by `font`. */
+ fontfile?: string;
+ /** Integral number of pixels to word-wrap at. Lines of text wider than this will be broken at word boundaries. (optional, default `0`) */
+ width?: number;
+ /**
+ * Integral number of pixels high. When defined, `dpi` will be ignored and the text will automatically fit the pixel resolution
+ * defined by `width` and `height`. Will be ignored if `width` is not specified or set to 0. (optional, default `0`)
+ */
+ height?: number;
+ /** Text alignment ('left', 'centre', 'center', 'right'). (optional, default 'left') */
+ align?: TextAlign;
+ /** Set this to true to apply justification to the text. (optional, default `false`) */
+ justify?: boolean;
+ /** The resolution (size) at which to render the text. Does not take effect if `height` is specified. (optional, default `72`) */
+ dpi?: number;
+ /**
+ * Set this to true to enable RGBA output. This is useful for colour emoji rendering,
+ * or support for pango markup features like `Red!`. (optional, default `false`)
+ */
+ rgba?: boolean;
+ /** Text line height in points. Will use the font line height if none is specified. (optional, default `0`) */
+ spacing?: number;
+ /** Word wrapping style when width is provided, one of: 'word', 'char', 'word-char' (prefer word, fallback to char) or 'none' */
+ wrap?: TextWrap;
+ }
+
+ interface Join {
+ /** Number of images per row. */
+ across?: number | undefined;
+ /** Treat input as frames of an animated image. */
+ animated?: boolean | undefined;
+ /** Space between images, in pixels. */
+ shim?: number | undefined;
+ /** Background colour. */
+ background?: Colour | Color | undefined;
+ /** Horizontal alignment. */
+ halign?: HorizontalAlignment | undefined;
+ /** Vertical alignment. */
+ valign?: VerticalAlignment | undefined;
+ }
+
+ interface TiffInputOptions {
+ /** Sub Image File Directory to extract, defaults to main image. Use -1 for all subifds. */
+ subifd?: number | undefined;
+ }
+
+ interface SvgInputOptions {
+ /** Custom CSS for SVG input, applied with a User Origin during the CSS cascade. */
+ stylesheet?: string | undefined;
+ /** Set to `true` to render SVG input at 32-bits per channel (128-bit) instead of 8-bits per channel (32-bit) RGBA. */
+ highBitdepth?: boolean | undefined;
+ }
+
+ interface PdfInputOptions {
+ /** Background colour to use when PDF is partially transparent. Requires the use of a globally-installed libvips compiled with support for PDFium, Poppler, ImageMagick or GraphicsMagick. */
+ background?: Colour | Color | undefined;
+ }
+
+ interface OpenSlideInputOptions {
+ /** Level to extract from a multi-level input, zero based. (optional, default 0) */
+ level?: number | undefined;
+ }
+
+ interface Jp2InputOptions {
+ /** Set to `true` to load JPEG 2000 images using [oneshot mode](https://github.com/libvips/libvips/issues/4205) */
+ oneshot?: boolean | undefined;
+ }
+
+ interface ExifDir {
+ [k: string]: string;
+ }
+
+ interface Exif {
+ 'IFD0'?: ExifDir;
+ 'IFD1'?: ExifDir;
+ 'IFD2'?: ExifDir;
+ 'IFD3'?: ExifDir;
+ }
+
+ type HeifCompression = 'av1' | 'hevc';
+
+ type Unit = 'inch' | 'cm';
+
+ interface WriteableMetadata {
+ /** Number of pixels per inch (DPI) */
+ density?: number | undefined;
+ /** Value between 1 and 8, used to update the EXIF Orientation tag. */
+ orientation?: number | undefined;
+ /**
+ * Filesystem path to output ICC profile, defaults to sRGB.
+ * @deprecated Use `withIccProfile()` instead.
+ */
+ icc?: string | undefined;
+ /**
+ * Object keyed by IFD0, IFD1 etc. of key/value string pairs to write as EXIF data.
+ * @deprecated Use `withExif()` or `withExifMerge()` instead.
+ */
+ exif?: Exif | undefined;
+ }
+
+ interface Metadata {
+ /** Number value of the EXIF Orientation header, if present */
+ orientation?: number | undefined;
+ /** Name of decoder used to decompress image data e.g. jpeg, png, webp, gif, svg */
+ format: keyof FormatEnum;
+ /** Total size of image in bytes, for Stream and Buffer input only */
+ size?: number | undefined;
+ /** Number of pixels wide (EXIF orientation is not taken into consideration) */
+ width: number;
+ /** Number of pixels high (EXIF orientation is not taken into consideration) */
+ height: number;
+ /** Any changed metadata after the image orientation is applied. */
+ autoOrient: {
+ /** Number of pixels wide (EXIF orientation is taken into consideration) */
+ width: number;
+ /** Number of pixels high (EXIF orientation is taken into consideration) */
+ height: number;
+ };
+ /** Name of colour space interpretation */
+ space: keyof ColourspaceEnum;
+ /** Number of bands e.g. 3 for sRGB, 4 for CMYK */
+ channels: Channels;
+ /** Name of pixel depth format e.g. uchar, char, ushort, float ... */
+ depth: keyof DepthEnum;
+ /** Number of pixels per inch (DPI), if present */
+ density?: number | undefined;
+ /** String containing JPEG chroma subsampling, 4:2:0 or 4:4:4 for RGB, 4:2:0:4 or 4:4:4:4 for CMYK */
+ chromaSubsampling?: string | undefined;
+ /** Boolean indicating whether the image is interlaced using a progressive scan */
+ isProgressive: boolean;
+ /** Boolean indicating whether the image is palette-based (GIF, PNG). */
+ isPalette: boolean;
+ /** Number of bits per sample for each channel (GIF, PNG). */
+ bitsPerSample?: number | undefined;
+ /** Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP */
+ pages?: number | undefined;
+ /** Number of pixels high each page in a multi-page image will be. */
+ pageHeight?: number | undefined;
+ /** Number of times to loop an animated image, zero refers to a continuous loop. */
+ loop?: number | undefined;
+ /** Delay in ms between each page in an animated image, provided as an array of integers. */
+ delay?: number[] | undefined;
+ /** Number of the primary page in a HEIF image */
+ pagePrimary?: number | undefined;
+ /** Boolean indicating the presence of an embedded ICC profile */
+ hasProfile: boolean;
+ /** Boolean indicating the presence of an alpha transparency channel */
+ hasAlpha: boolean;
+ /** Buffer containing raw EXIF data, if present */
+ exif?: Buffer | undefined;
+ /** Buffer containing raw ICC profile data, if present */
+ icc?: Buffer | undefined;
+ /** Buffer containing raw IPTC data, if present */
+ iptc?: Buffer | undefined;
+ /** Buffer containing raw XMP data, if present */
+ xmp?: Buffer | undefined;
+ /** String containing XMP data, if valid UTF-8 */
+ xmpAsString?: string | undefined;
+ /** Buffer containing raw TIFFTAG_PHOTOSHOP data, if present */
+ tifftagPhotoshop?: Buffer | undefined;
+ /** The encoder used to compress an HEIF file, `av1` (AVIF) or `hevc` (HEIC) */
+ compression?: HeifCompression | undefined;
+ /** Default background colour, if present, for PNG (bKGD) and GIF images */
+ background?: { r: number; g: number; b: number } | { gray: number };
+ /** Details of each level in a multi-level image provided as an array of objects, requires libvips compiled with support for OpenSlide */
+ levels?: LevelMetadata[] | undefined;
+ /** Number of Sub Image File Directories in an OME-TIFF image */
+ subifds?: number | undefined;
+ /** The unit of resolution (density) */
+ resolutionUnit?: Unit | undefined;
+ /** String containing format for images loaded via *magick */
+ formatMagick?: string | undefined;
+ /** Array of keyword/text pairs representing PNG text blocks, if present. */
+ comments?: CommentsMetadata[] | undefined;
+ }
+
+ interface LevelMetadata {
+ width: number;
+ height: number;
+ }
+
+ interface CommentsMetadata {
+ keyword: string;
+ text: string;
+ }
+
+ interface Stats {
+ /** Array of channel statistics for each channel in the image. */
+ channels: ChannelStats[];
+ /** Value to identify if the image is opaque or transparent, based on the presence and use of alpha channel */
+ isOpaque: boolean;
+ /** Histogram-based estimation of greyscale entropy, discarding alpha channel if any (experimental) */
+ entropy: number;
+ /** Estimation of greyscale sharpness based on the standard deviation of a Laplacian convolution, discarding alpha channel if any (experimental) */
+ sharpness: number;
+ /** Object containing most dominant sRGB colour based on a 4096-bin 3D histogram (experimental) */
+ dominant: { r: number; g: number; b: number };
+ }
+
+ interface ChannelStats {
+ /** minimum value in the channel */
+ min: number;
+ /** maximum value in the channel */
+ max: number;
+ /** sum of all values in a channel */
+ sum: number;
+ /** sum of squared values in a channel */
+ squaresSum: number;
+ /** mean of the values in a channel */
+ mean: number;
+ /** standard deviation for the values in a channel */
+ stdev: number;
+ /** x-coordinate of one of the pixel where the minimum lies */
+ minX: number;
+ /** y-coordinate of one of the pixel where the minimum lies */
+ minY: number;
+ /** x-coordinate of one of the pixel where the maximum lies */
+ maxX: number;
+ /** y-coordinate of one of the pixel where the maximum lies */
+ maxY: number;
+ }
+
+ interface OutputOptions {
+ /** Force format output, otherwise attempt to use input format (optional, default true) */
+ force?: boolean | undefined;
+ }
+
+ interface WithIccProfileOptions {
+ /** Should the ICC profile be included in the output image metadata? (optional, default true) */
+ attach?: boolean | undefined;
+ }
+
+ interface JpegOptions extends OutputOptions {
+ /** Quality, integer 1-100 (optional, default 80) */
+ quality?: number | undefined;
+ /** Use progressive (interlace) scan (optional, default false) */
+ progressive?: boolean | undefined;
+ /** Set to '4:4:4' to prevent chroma subsampling when quality <= 90 (optional, default '4:2:0') */
+ chromaSubsampling?: string | undefined;
+ /** Apply trellis quantisation (optional, default false) */
+ trellisQuantisation?: boolean | undefined;
+ /** Apply overshoot deringing (optional, default false) */
+ overshootDeringing?: boolean | undefined;
+ /** Optimise progressive scans, forces progressive (optional, default false) */
+ optimiseScans?: boolean | undefined;
+ /** Alternative spelling of optimiseScans (optional, default false) */
+ optimizeScans?: boolean | undefined;
+ /** Optimise Huffman coding tables (optional, default true) */
+ optimiseCoding?: boolean | undefined;
+ /** Alternative spelling of optimiseCoding (optional, default true) */
+ optimizeCoding?: boolean | undefined;
+ /** Quantization table to use, integer 0-8 (optional, default 0) */
+ quantisationTable?: number | undefined;
+ /** Alternative spelling of quantisationTable (optional, default 0) */
+ quantizationTable?: number | undefined;
+ /** Use mozjpeg defaults (optional, default false) */
+ mozjpeg?: boolean | undefined;
+ }
+
+ interface Jp2Options extends OutputOptions {
+ /** Quality, integer 1-100 (optional, default 80) */
+ quality?: number;
+ /** Use lossless compression mode (optional, default false) */
+ lossless?: boolean;
+ /** Horizontal tile size (optional, default 512) */
+ tileWidth?: number;
+ /** Vertical tile size (optional, default 512) */
+ tileHeight?: number;
+ /** Set to '4:2:0' to enable chroma subsampling (optional, default '4:4:4') */
+ chromaSubsampling?: '4:4:4' | '4:2:0';
+ }
+
+ interface JxlOptions extends OutputOptions {
+ /** Maximum encoding error, between 0 (highest quality) and 15 (lowest quality) (optional, default 1.0) */
+ distance?: number;
+ /** Calculate distance based on JPEG-like quality, between 1 and 100, overrides distance if specified */
+ quality?: number;
+ /** Target decode speed tier, between 0 (highest quality) and 4 (lowest quality) (optional, default 0) */
+ decodingTier?: number;
+ /** Use lossless compression (optional, default false) */
+ lossless?: boolean;
+ /** CPU effort, between 3 (fastest) and 9 (slowest) (optional, default 7) */
+ effort?: number | undefined;
+ }
+
+ interface WebpOptions extends OutputOptions, AnimationOptions {
+ /** Quality, integer 1-100 (optional, default 80) */
+ quality?: number | undefined;
+ /** Quality of alpha layer, number from 0-100 (optional, default 100) */
+ alphaQuality?: number | undefined;
+ /** Use lossless compression mode (optional, default false) */
+ lossless?: boolean | undefined;
+ /** Use near_lossless compression mode (optional, default false) */
+ nearLossless?: boolean | undefined;
+ /** Use high quality chroma subsampling (optional, default false) */
+ smartSubsample?: boolean | undefined;
+ /** Auto-adjust the deblocking filter, slow but can improve low contrast edges (optional, default false) */
+ smartDeblock?: boolean | undefined;
+ /** Level of CPU effort to reduce file size, integer 0-6 (optional, default 4) */
+ effort?: number | undefined;
+ /** Prevent use of animation key frames to minimise file size (slow) (optional, default false) */
+ minSize?: boolean;
+ /** Allow mixture of lossy and lossless animation frames (slow) (optional, default false) */
+ mixed?: boolean;
+ /** Preset options: one of default, photo, picture, drawing, icon, text (optional, default 'default') */
+ preset?: keyof PresetEnum | undefined;
+ }
+
+ interface AvifOptions extends OutputOptions {
+ /** quality, integer 1-100 (optional, default 50) */
+ quality?: number | undefined;
+ /** use lossless compression (optional, default false) */
+ lossless?: boolean | undefined;
+ /** Level of CPU effort to reduce file size, between 0 (fastest) and 9 (slowest) (optional, default 4) */
+ effort?: number | undefined;
+ /** set to '4:2:0' to use chroma subsampling, requires libvips v8.11.0 (optional, default '4:4:4') */
+ chromaSubsampling?: string | undefined;
+ /** Set bitdepth to 8, 10 or 12 bit (optional, default 8) */
+ bitdepth?: 8 | 10 | 12 | undefined;
+ }
+
+ interface HeifOptions extends OutputOptions {
+ /** quality, integer 1-100 (optional, default 50) */
+ quality?: number | undefined;
+ /** compression format: av1, hevc (optional, default 'av1') */
+ compression?: HeifCompression | undefined;
+ /** use lossless compression (optional, default false) */
+ lossless?: boolean | undefined;
+ /** Level of CPU effort to reduce file size, between 0 (fastest) and 9 (slowest) (optional, default 4) */
+ effort?: number | undefined;
+ /** set to '4:2:0' to use chroma subsampling (optional, default '4:4:4') */
+ chromaSubsampling?: string | undefined;
+ /** Set bitdepth to 8, 10 or 12 bit (optional, default 8) */
+ bitdepth?: 8 | 10 | 12 | undefined;
+ }
+
+ interface GifOptions extends OutputOptions, AnimationOptions {
+ /** Re-use existing palette, otherwise generate new (slow) */
+ reuse?: boolean | undefined;
+ /** Use progressive (interlace) scan */
+ progressive?: boolean | undefined;
+ /** Maximum number of palette entries, including transparency, between 2 and 256 (optional, default 256) */
+ colours?: number | undefined;
+ /** Alternative spelling of "colours". Maximum number of palette entries, including transparency, between 2 and 256 (optional, default 256) */
+ colors?: number | undefined;
+ /** Level of CPU effort to reduce file size, between 1 (fastest) and 10 (slowest) (optional, default 7) */
+ effort?: number | undefined;
+ /** Level of Floyd-Steinberg error diffusion, between 0 (least) and 1 (most) (optional, default 1.0) */
+ dither?: number | undefined;
+ /** Maximum inter-frame error for transparency, between 0 (lossless) and 32 (optional, default 0) */
+ interFrameMaxError?: number | undefined;
+ /** Maximum inter-palette error for palette reuse, between 0 and 256 (optional, default 3) */
+ interPaletteMaxError?: number | undefined;
+ /** Keep duplicate frames in the output instead of combining them (optional, default false) */
+ keepDuplicateFrames?: boolean | undefined;
+ }
+
+ interface TiffOptions extends OutputOptions {
+ /** Quality, integer 1-100 (optional, default 80) */
+ quality?: number | undefined;
+ /** Compression options: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k (optional, default 'jpeg') */
+ compression?: string | undefined;
+ /** Use BigTIFF variant (has no effect when compression is none) (optional, default false) */
+ bigtiff?: boolean | undefined;
+ /** Compression predictor options: none, horizontal, float (optional, default 'horizontal') */
+ predictor?: string | undefined;
+ /** Write an image pyramid (optional, default false) */
+ pyramid?: boolean | undefined;
+ /** Write a tiled tiff (optional, default false) */
+ tile?: boolean | undefined;
+ /** Horizontal tile size (optional, default 256) */
+ tileWidth?: number | undefined;
+ /** Vertical tile size (optional, default 256) */
+ tileHeight?: number | undefined;
+ /** Horizontal resolution in pixels/mm (optional, default 1.0) */
+ xres?: number | undefined;
+ /** Vertical resolution in pixels/mm (optional, default 1.0) */
+ yres?: number | undefined;
+ /** Reduce bitdepth to 1, 2 or 4 bit (optional, default 8) */
+ bitdepth?: 1 | 2 | 4 | 8 | undefined;
+ /** Write 1-bit images as miniswhite (optional, default false) */
+ miniswhite?: boolean | undefined;
+ /** Resolution unit options: inch, cm (optional, default 'inch') */
+ resolutionUnit?: Unit | undefined;
+ }
+
+ interface PngOptions extends OutputOptions {
+ /** Use progressive (interlace) scan (optional, default false) */
+ progressive?: boolean | undefined;
+ /** zlib compression level, 0-9 (optional, default 6) */
+ compressionLevel?: number | undefined;
+ /** Use adaptive row filtering (optional, default false) */
+ adaptiveFiltering?: boolean | undefined;
+ /** Use the lowest number of colours needed to achieve given quality (optional, default `100`) */
+ quality?: number | undefined;
+ /** Level of CPU effort to reduce file size, between 1 (fastest) and 10 (slowest), sets palette to true (optional, default 7) */
+ effort?: number | undefined;
+ /** Quantise to a palette-based image with alpha transparency support (optional, default false) */
+ palette?: boolean | undefined;
+ /** Maximum number of palette entries (optional, default 256) */
+ colours?: number | undefined;
+ /** Alternative Spelling of "colours". Maximum number of palette entries (optional, default 256) */
+ colors?: number | undefined;
+ /** Level of Floyd-Steinberg error diffusion (optional, default 1.0) */
+ dither?: number | undefined;
+ }
+
+ interface RotateOptions {
+ /** parsed by the color module to extract values for red, green, blue and alpha. (optional, default "#000000") */
+ background?: Colour | Color | undefined;
+ }
+
+ type Precision = 'integer' | 'float' | 'approximate';
+
+ interface BlurOptions {
+ /** A value between 0.3 and 1000 representing the sigma of the Gaussian mask, where `sigma = 1 + radius / 2` */
+ sigma: number;
+ /** A value between 0.001 and 1. A smaller value will generate a larger, more accurate mask. */
+ minAmplitude?: number;
+ /** How accurate the operation should be, one of: integer, float, approximate. (optional, default "integer") */
+ precision?: Precision | undefined;
+ }
+
+ interface FlattenOptions {
+ /** background colour, parsed by the color module, defaults to black. (optional, default {r:0,g:0,b:0}) */
+ background?: Colour | Color | undefined;
+ }
+
+ interface NegateOptions {
+ /** whether or not to negate any alpha channel. (optional, default true) */
+ alpha?: boolean | undefined;
+ }
+
+ interface NormaliseOptions {
+ /** Percentile below which luminance values will be underexposed. */
+ lower?: number | undefined;
+ /** Percentile above which luminance values will be overexposed. */
+ upper?: number | undefined;
+ }
+
+ interface ResizeOptions {
+ /** Alternative means of specifying width. If both are present this takes priority. */
+ width?: number | undefined;
+ /** Alternative means of specifying height. If both are present this takes priority. */
+ height?: number | undefined;
+ /** How the image should be resized to fit both provided dimensions, one of cover, contain, fill, inside or outside. (optional, default 'cover') */
+ fit?: keyof FitEnum | undefined;
+ /** Position, gravity or strategy to use when fit is cover or contain. (optional, default 'centre') */
+ position?: number | string | undefined;
+ /** Background colour when using a fit of contain, parsed by the color module, defaults to black without transparency. (optional, default {r:0,g:0,b:0,alpha:1}) */
+ background?: Colour | Color | undefined;
+ /** The kernel to use for image reduction. (optional, default 'lanczos3') */
+ kernel?: keyof KernelEnum | undefined;
+ /** Do not enlarge if the width or height are already less than the specified dimensions, equivalent to GraphicsMagick's > geometry option. (optional, default false) */
+ withoutEnlargement?: boolean | undefined;
+ /** Do not reduce if the width or height are already greater than the specified dimensions, equivalent to GraphicsMagick's < geometry option. (optional, default false) */
+ withoutReduction?: boolean | undefined;
+ /** Take greater advantage of the JPEG and WebP shrink-on-load feature, which can lead to a slight moiré pattern on some images. (optional, default true) */
+ fastShrinkOnLoad?: boolean | undefined;
+ }
+
+ interface Region {
+ /** zero-indexed offset from left edge */
+ left: number;
+ /** zero-indexed offset from top edge */
+ top: number;
+ /** dimension of extracted image */
+ width: number;
+ /** dimension of extracted image */
+ height: number;
+ }
+
+ interface Noise {
+ /** type of generated noise, currently only gaussian is supported. */
+ type: 'gaussian';
+ /** mean of pixels in generated noise. */
+ mean?: number | undefined;
+ /** standard deviation of pixels in generated noise. */
+ sigma?: number | undefined;
+ }
+
+ type ExtendWith = 'background' | 'copy' | 'repeat' | 'mirror';
+
+ interface ExtendOptions {
+ /** single pixel count to top edge (optional, default 0) */
+ top?: number | undefined;
+ /** single pixel count to left edge (optional, default 0) */
+ left?: number | undefined;
+ /** single pixel count to bottom edge (optional, default 0) */
+ bottom?: number | undefined;
+ /** single pixel count to right edge (optional, default 0) */
+ right?: number | undefined;
+ /** background colour, parsed by the color module, defaults to black without transparency. (optional, default {r:0,g:0,b:0,alpha:1}) */
+ background?: Colour | Color | undefined;
+ /** how the extension is done, one of: "background", "copy", "repeat", "mirror" (optional, default `'background'`) */
+ extendWith?: ExtendWith | undefined;
+ }
+
+ interface TrimOptions {
+ /** Background colour, parsed by the color module, defaults to that of the top-left pixel. (optional) */
+ background?: Colour | Color | undefined;
+ /** Allowed difference from the above colour, a positive number. (optional, default 10) */
+ threshold?: number | undefined;
+ /** Does the input more closely resemble line art (e.g. vector) rather than being photographic? (optional, default false) */
+ lineArt?: boolean | undefined;
+ }
+
+ interface RawOptions {
+ depth?: keyof DepthEnum;
+ }
+
+ /** 1 for grayscale, 2 for grayscale + alpha, 3 for sRGB, 4 for CMYK or RGBA */
+ type Channels = 1 | 2 | 3 | 4;
+
+ interface RGBA {
+ r?: number | undefined;
+ g?: number | undefined;
+ b?: number | undefined;
+ alpha?: number | undefined;
+ }
+
+ type Colour = string | RGBA;
+ type Color = Colour;
+
+ interface Kernel {
+ /** width of the kernel in pixels. */
+ width: number;
+ /** height of the kernel in pixels. */
+ height: number;
+ /** Array of length width*height containing the kernel values. */
+ kernel: ArrayLike;
+ /** the scale of the kernel in pixels. (optional, default sum) */
+ scale?: number | undefined;
+ /** the offset of the kernel in pixels. (optional, default 0) */
+ offset?: number | undefined;
+ }
+
+ interface ClaheOptions {
+ /** width of the region */
+ width: number;
+ /** height of the region */
+ height: number;
+ /** max slope of the cumulative contrast. A value of 0 disables contrast limiting. Valid values are integers in the range 0-100 (inclusive) (optional, default 3) */
+ maxSlope?: number | undefined;
+ }
+
+ interface ThresholdOptions {
+ /** convert to single channel greyscale. (optional, default true) */
+ greyscale?: boolean | undefined;
+ /** alternative spelling for greyscale. (optional, default true) */
+ grayscale?: boolean | undefined;
+ }
+
+ interface OverlayOptions extends SharpOptions {
+ /** Buffer containing image data, String containing the path to an image file, or Create object */
+ input?: string | Buffer | { create: Create } | { text: CreateText } | { raw: CreateRaw } | undefined;
+ /** how to blend this image with the image below. (optional, default `'over'`) */
+ blend?: Blend | undefined;
+ /** gravity at which to place the overlay. (optional, default 'centre') */
+ gravity?: Gravity | undefined;
+ /** the pixel offset from the top edge. */
+ top?: number | undefined;
+ /** the pixel offset from the left edge. */
+ left?: number | undefined;
+ /** set to true to repeat the overlay image across the entire image with the given gravity. (optional, default false) */
+ tile?: boolean | undefined;
+ /** Set to true to avoid premultipling the image below. Equivalent to the --premultiplied vips option. */
+ premultiplied?: boolean | undefined;
+ /** number representing the DPI for vector overlay image. (optional, default 72)*/
+ density?: number | undefined;
+ /** Set to true to read all frames/pages of an animated image. (optional, default false) */
+ animated?: boolean | undefined;
+ /** see sharp() constructor, (optional, default 'warning') */
+ failOn?: FailOnOptions | undefined;
+ /** see sharp() constructor, (optional, default 268402689) */
+ limitInputPixels?: number | boolean | undefined;
+ /** see sharp() constructor, (optional, default false) */
+ autoOrient?: boolean | undefined;
+ }
+
+ interface TileOptions {
+ /** Tile size in pixels, a value between 1 and 8192. (optional, default 256) */
+ size?: number | undefined;
+ /** Tile overlap in pixels, a value between 0 and 8192. (optional, default 0) */
+ overlap?: number | undefined;
+ /** Tile angle of rotation, must be a multiple of 90. (optional, default 0) */
+ angle?: number | undefined;
+ /** background colour, parsed by the color module, defaults to white without transparency. (optional, default {r:255,g:255,b:255,alpha:1}) */
+ background?: string | RGBA | undefined;
+ /** How deep to make the pyramid, possible values are "onepixel", "onetile" or "one" (default based on layout) */
+ depth?: string | undefined;
+ /** Threshold to skip tile generation, a value 0 - 255 for 8-bit images or 0 - 65535 for 16-bit images */
+ skipBlanks?: number | undefined;
+ /** Tile container, with value fs (filesystem) or zip (compressed file). (optional, default 'fs') */
+ container?: TileContainer | undefined;
+ /** Filesystem layout, possible values are dz, iiif, iiif3, zoomify or google. (optional, default 'dz') */
+ layout?: TileLayout | undefined;
+ /** Centre image in tile. (optional, default false) */
+ centre?: boolean | undefined;
+ /** Alternative spelling of centre. (optional, default false) */
+ center?: boolean | undefined;
+ /** When layout is iiif/iiif3, sets the @id/id attribute of info.json (optional, default 'https://example.com/iiif') */
+ id?: string | undefined;
+ /** The name of the directory within the zip file when container is `zip`. */
+ basename?: string | undefined;
+ }
+
+ interface AnimationOptions {
+ /** Number of animation iterations, a value between 0 and 65535. Use 0 for infinite animation. (optional, default 0) */
+ loop?: number | undefined;
+ /** delay(s) between animation frames (in milliseconds), each value between 0 and 65535. (optional) */
+ delay?: number | number[] | undefined;
+ }
+
+ interface SharpenOptions {
+ /** The sigma of the Gaussian mask, where sigma = 1 + radius / 2, between 0.000001 and 10000 */
+ sigma: number;
+ /** The level of sharpening to apply to "flat" areas, between 0 and 1000000 (optional, default 1.0) */
+ m1?: number | undefined;
+ /** The level of sharpening to apply to "jagged" areas, between 0 and 1000000 (optional, default 2.0) */
+ m2?: number | undefined;
+ /** Threshold between "flat" and "jagged", between 0 and 1000000 (optional, default 2.0) */
+ x1?: number | undefined;
+ /** Maximum amount of brightening, between 0 and 1000000 (optional, default 10.0) */
+ y2?: number | undefined;
+ /** Maximum amount of darkening, between 0 and 1000000 (optional, default 20.0) */
+ y3?: number | undefined;
+ }
+
+ interface AffineOptions {
+ /** Parsed by the color module to extract values for red, green, blue and alpha. (optional, default "#000000") */
+ background?: string | object | undefined;
+ /** Input horizontal offset (optional, default 0) */
+ idx?: number | undefined;
+ /** Input vertical offset (optional, default 0) */
+ idy?: number | undefined;
+ /** Output horizontal offset (optional, default 0) */
+ odx?: number | undefined;
+ /** Output horizontal offset (optional, default 0) */
+ ody?: number | undefined;
+ /** Interpolator (optional, default sharp.interpolators.bicubic) */
+ interpolator?: Interpolators[keyof Interpolators] | undefined;
+ }
+
+ interface OutputInfo {
+ format: string;
+ size: number;
+ width: number;
+ height: number;
+ channels: Channels;
+ /** indicating if premultiplication was used */
+ premultiplied: boolean;
+ /** Only defined when using a crop strategy */
+ cropOffsetLeft?: number | undefined;
+ /** Only defined when using a crop strategy */
+ cropOffsetTop?: number | undefined;
+ /** Only defined when using a trim method */
+ trimOffsetLeft?: number | undefined;
+ /** Only defined when using a trim method */
+ trimOffsetTop?: number | undefined;
+ /** DPI the font was rendered at, only defined when using `text` input */
+ textAutofitDpi?: number | undefined;
+ /** When using the attention crop strategy, the focal point of the cropped region */
+ attentionX?: number | undefined;
+ attentionY?: number | undefined;
+ /** Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP */
+ pages?: number | undefined;
+ /** Number of pixels high each page in a multi-page image will be. */
+ pageHeight?: number | undefined;
+ }
+
+ interface AvailableFormatInfo {
+ id: string;
+ input: { file: boolean; buffer: boolean; stream: boolean; fileSuffix?: string[] };
+ output: { file: boolean; buffer: boolean; stream: boolean; alias?: string[] };
+ }
+
+ interface FitEnum {
+ contain: 'contain';
+ cover: 'cover';
+ fill: 'fill';
+ inside: 'inside';
+ outside: 'outside';
+ }
+
+ interface KernelEnum {
+ nearest: 'nearest';
+ cubic: 'cubic';
+ linear: 'linear';
+ mitchell: 'mitchell';
+ lanczos2: 'lanczos2';
+ lanczos3: 'lanczos3';
+ mks2013: 'mks2013';
+ mks2021: 'mks2021';
+ }
+
+ interface PresetEnum {
+ default: 'default';
+ picture: 'picture';
+ photo: 'photo';
+ drawing: 'drawing';
+ icon: 'icon';
+ text: 'text';
+ }
+
+ interface BoolEnum {
+ and: 'and';
+ or: 'or';
+ eor: 'eor';
+ }
+
+ interface ColourspaceEnum {
+ 'b-w': string;
+ cmc: string;
+ cmyk: string;
+ fourier: string;
+ grey16: string;
+ histogram: string;
+ hsv: string;
+ lab: string;
+ labq: string;
+ labs: string;
+ lch: string;
+ matrix: string;
+ multiband: string;
+ rgb: string;
+ rgb16: string;
+ scrgb: string;
+ srgb: string;
+ xyz: string;
+ yxy: string;
+ }
+
+ interface DepthEnum {
+ char: string;
+ complex: string;
+ double: string;
+ dpcomplex: string;
+ float: string;
+ int: string;
+ short: string;
+ uchar: string;
+ uint: string;
+ ushort: string;
+ }
+
+ type FailOnOptions = 'none' | 'truncated' | 'error' | 'warning';
+
+ type TextAlign = 'left' | 'centre' | 'center' | 'right';
+
+ type TextWrap = 'word' | 'char' | 'word-char' | 'none';
+
+ type HorizontalAlignment = 'left' | 'centre' | 'center' | 'right';
+
+ type VerticalAlignment = 'top' | 'centre' | 'center' | 'bottom';
+
+ type TileContainer = 'fs' | 'zip';
+
+ type TileLayout = 'dz' | 'iiif' | 'iiif3' | 'zoomify' | 'google';
+
+ type Blend =
+ | 'clear'
+ | 'source'
+ | 'over'
+ | 'in'
+ | 'out'
+ | 'atop'
+ | 'dest'
+ | 'dest-over'
+ | 'dest-in'
+ | 'dest-out'
+ | 'dest-atop'
+ | 'xor'
+ | 'add'
+ | 'saturate'
+ | 'multiply'
+ | 'screen'
+ | 'overlay'
+ | 'darken'
+ | 'lighten'
+ | 'color-dodge'
+ | 'colour-dodge'
+ | 'color-burn'
+ | 'colour-burn'
+ | 'hard-light'
+ | 'soft-light'
+ | 'difference'
+ | 'exclusion';
+
+ type Gravity = number | string;
+
+ interface GravityEnum {
+ north: number;
+ northeast: number;
+ southeast: number;
+ south: number;
+ southwest: number;
+ west: number;
+ northwest: number;
+ east: number;
+ center: number;
+ centre: number;
+ }
+
+ interface StrategyEnum {
+ entropy: number;
+ attention: number;
+ }
+
+ interface FormatEnum {
+ avif: AvailableFormatInfo;
+ dcraw: AvailableFormatInfo;
+ dz: AvailableFormatInfo;
+ exr: AvailableFormatInfo;
+ fits: AvailableFormatInfo;
+ gif: AvailableFormatInfo;
+ heif: AvailableFormatInfo;
+ input: AvailableFormatInfo;
+ jpeg: AvailableFormatInfo;
+ jpg: AvailableFormatInfo;
+ jp2: AvailableFormatInfo;
+ jxl: AvailableFormatInfo;
+ magick: AvailableFormatInfo;
+ openslide: AvailableFormatInfo;
+ pdf: AvailableFormatInfo;
+ png: AvailableFormatInfo;
+ ppm: AvailableFormatInfo;
+ rad: AvailableFormatInfo;
+ raw: AvailableFormatInfo;
+ svg: AvailableFormatInfo;
+ tiff: AvailableFormatInfo;
+ tif: AvailableFormatInfo;
+ v: AvailableFormatInfo;
+ webp: AvailableFormatInfo;
+ }
+
+ interface CacheResult {
+ memory: { current: number; high: number; max: number };
+ files: { current: number; max: number };
+ items: { current: number; max: number };
+ }
+
+ interface Interpolators {
+ /** [Nearest neighbour interpolation](http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation). Suitable for image enlargement only. */
+ nearest: 'nearest';
+ /** [Bilinear interpolation](http://en.wikipedia.org/wiki/Bilinear_interpolation). Faster than bicubic but with less smooth results. */
+ bilinear: 'bilinear';
+ /** [Bicubic interpolation](http://en.wikipedia.org/wiki/Bicubic_interpolation) (the default). */
+ bicubic: 'bicubic';
+ /**
+ * [LBB interpolation](https://github.com/libvips/libvips/blob/master/libvips/resample/lbb.cpp#L100).
+ * Prevents some "[acutance](http://en.wikipedia.org/wiki/Acutance)" but typically reduces performance by a factor of 2.
+ */
+ locallyBoundedBicubic: 'lbb';
+ /** [Nohalo interpolation](http://eprints.soton.ac.uk/268086/). Prevents acutance but typically reduces performance by a factor of 3. */
+ nohalo: 'nohalo';
+ /** [VSQBS interpolation](https://github.com/libvips/libvips/blob/master/libvips/resample/vsqbs.cpp#L48). Prevents "staircasing" when enlarging. */
+ vertexSplitQuadraticBasisSpline: 'vsqbs';
+ }
+
+ type Matrix2x2 = [[number, number], [number, number]];
+ type Matrix3x3 = [[number, number, number], [number, number, number], [number, number, number]];
+ type Matrix4x4 = [[number, number, number, number], [number, number, number, number], [number, number, number, number], [number, number, number, number]];
+}
+
+export = sharp;
diff --git a/lib/index.js b/lib/index.js
index 56fa29423..b80191d71 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,4 +1,7 @@
-'use strict';
+/*!
+ Copyright 2013 Lovell Fuller and others.
+ SPDX-License-Identifier: Apache-2.0
+*/
const Sharp = require('./constructor');
require('./input')(Sharp);
diff --git a/lib/input.js b/lib/input.js
index a81036d66..48388a1d2 100644
--- a/lib/input.js
+++ b/lib/input.js
@@ -1,17 +1,48 @@
-'use strict';
+/*!
+ Copyright 2013 Lovell Fuller and others.
+ SPDX-License-Identifier: Apache-2.0
+*/
-const color = require('color');
const is = require('./is');
-const sharp = require('../build/Release/sharp.node');
+const sharp = require('./sharp');
+
+/**
+ * Justification alignment
+ * @member
+ * @private
+ */
+const align = {
+ left: 'low',
+ top: 'low',
+ low: 'low',
+ center: 'centre',
+ centre: 'centre',
+ right: 'high',
+ bottom: 'high',
+ high: 'high'
+};
+
+const inputStreamParameters = [
+ // Limits and error handling
+ 'failOn', 'limitInputPixels', 'unlimited',
+ // Format-generic
+ 'animated', 'autoOrient', 'density', 'ignoreIcc', 'page', 'pages', 'sequentialRead',
+ // Format-specific
+ 'jp2', 'openSlide', 'pdf', 'raw', 'svg', 'tiff',
+ // Deprecated
+ 'failOnError', 'openSlideLevel', 'pdfBackground', 'tiffSubifd'
+];
/**
* Extract input options, if any, from an object.
* @private
*/
function _inputOptionsFromObject (obj) {
- const { raw, density, limitInputPixels, sequentialRead, failOnError, animated, page, pages } = obj;
- return [raw, density, limitInputPixels, sequentialRead, failOnError, animated, page, pages].some(is.defined)
- ? { raw, density, limitInputPixels, sequentialRead, failOnError, animated, page, pages }
+ const params = inputStreamParameters
+ .filter(p => is.defined(obj[p]))
+ .map(p => ([p, obj[p]]));
+ return params.length
+ ? Object.fromEntries(params)
: undefined;
}
@@ -21,19 +52,32 @@ function _inputOptionsFromObject (obj) {
*/
function _createInputDescriptor (input, inputOptions, containerOptions) {
const inputDescriptor = {
- failOnError: true,
- limitInputPixels: Math.pow(0x3FFF, 2),
- sequentialRead: false
+ autoOrient: false,
+ failOn: 'warning',
+ limitInputPixels: 0x3FFF ** 2,
+ ignoreIcc: false,
+ unlimited: false,
+ sequentialRead: true
};
if (is.string(input)) {
// filesystem
inputDescriptor.file = input;
} else if (is.buffer(input)) {
// Buffer
+ if (input.length === 0) {
+ throw Error('Input Buffer is empty');
+ }
inputDescriptor.buffer = input;
- } else if (is.uint8Array(input)) {
- // Uint8Array or Uint8ClampedArray
- inputDescriptor.buffer = Buffer.from(input.buffer);
+ } else if (is.arrayBuffer(input)) {
+ if (input.byteLength === 0) {
+ throw Error('Input bit Array is empty');
+ }
+ inputDescriptor.buffer = Buffer.from(input, 0, input.byteLength);
+ } else if (is.typedArray(input)) {
+ if (input.length === 0) {
+ throw Error('Input Bit Array is empty');
+ }
+ inputDescriptor.buffer = Buffer.from(input.buffer, input.byteOffset, input.byteLength);
} else if (is.plainObject(input) && !is.defined(inputOptions)) {
// Plain Object descriptor, e.g. create
inputOptions = input;
@@ -44,20 +88,48 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
} else if (!is.defined(input) && !is.defined(inputOptions) && is.object(containerOptions) && containerOptions.allowStream) {
// Stream without options
inputDescriptor.buffer = [];
+ } else if (Array.isArray(input)) {
+ if (input.length > 1) {
+ // Join images together
+ if (!this.options.joining) {
+ this.options.joining = true;
+ this.options.join = input.map(i => this._createInputDescriptor(i));
+ } else {
+ throw new Error('Recursive join is unsupported');
+ }
+ } else {
+ throw new Error('Expected at least two images to join');
+ }
} else {
throw new Error(`Unsupported input '${input}' of type ${typeof input}${
is.defined(inputOptions) ? ` when also providing options of type ${typeof inputOptions}` : ''
}`);
}
if (is.object(inputOptions)) {
- // Fail on error
+ // Deprecated: failOnError
if (is.defined(inputOptions.failOnError)) {
if (is.bool(inputOptions.failOnError)) {
- inputDescriptor.failOnError = inputOptions.failOnError;
+ inputDescriptor.failOn = inputOptions.failOnError ? 'warning' : 'none';
} else {
throw is.invalidParameterError('failOnError', 'boolean', inputOptions.failOnError);
}
}
+ // failOn
+ if (is.defined(inputOptions.failOn)) {
+ if (is.string(inputOptions.failOn) && is.inArray(inputOptions.failOn, ['none', 'truncated', 'error', 'warning'])) {
+ inputDescriptor.failOn = inputOptions.failOn;
+ } else {
+ throw is.invalidParameterError('failOn', 'one of: none, truncated, error, warning', inputOptions.failOn);
+ }
+ }
+ // autoOrient
+ if (is.defined(inputOptions.autoOrient)) {
+ if (is.bool(inputOptions.autoOrient)) {
+ inputDescriptor.autoOrient = inputOptions.autoOrient;
+ } else {
+ throw is.invalidParameterError('autoOrient', 'boolean', inputOptions.autoOrient);
+ }
+ }
// Density
if (is.defined(inputOptions.density)) {
if (is.inRange(inputOptions.density, 1, 100000)) {
@@ -66,16 +138,32 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
throw is.invalidParameterError('density', 'number between 1 and 100000', inputOptions.density);
}
}
+ // Ignore embeddded ICC profile
+ if (is.defined(inputOptions.ignoreIcc)) {
+ if (is.bool(inputOptions.ignoreIcc)) {
+ inputDescriptor.ignoreIcc = inputOptions.ignoreIcc;
+ } else {
+ throw is.invalidParameterError('ignoreIcc', 'boolean', inputOptions.ignoreIcc);
+ }
+ }
// limitInputPixels
if (is.defined(inputOptions.limitInputPixels)) {
if (is.bool(inputOptions.limitInputPixels)) {
inputDescriptor.limitInputPixels = inputOptions.limitInputPixels
- ? Math.pow(0x3FFF, 2)
+ ? 0x3FFF ** 2
: 0;
- } else if (is.integer(inputOptions.limitInputPixels) && inputOptions.limitInputPixels >= 0) {
+ } else if (is.integer(inputOptions.limitInputPixels) && is.inRange(inputOptions.limitInputPixels, 0, Number.MAX_SAFE_INTEGER)) {
inputDescriptor.limitInputPixels = inputOptions.limitInputPixels;
} else {
- throw is.invalidParameterError('limitInputPixels', 'integer >= 0', inputOptions.limitInputPixels);
+ throw is.invalidParameterError('limitInputPixels', 'positive integer', inputOptions.limitInputPixels);
+ }
+ }
+ // unlimited
+ if (is.defined(inputOptions.unlimited)) {
+ if (is.bool(inputOptions.unlimited)) {
+ inputDescriptor.unlimited = inputOptions.unlimited;
+ } else {
+ throw is.invalidParameterError('unlimited', 'boolean', inputOptions.unlimited);
}
}
// sequentialRead
@@ -97,9 +185,58 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
inputDescriptor.rawWidth = inputOptions.raw.width;
inputDescriptor.rawHeight = inputOptions.raw.height;
inputDescriptor.rawChannels = inputOptions.raw.channels;
+ switch (input.constructor) {
+ case Uint8Array:
+ case Uint8ClampedArray:
+ inputDescriptor.rawDepth = 'uchar';
+ break;
+ case Int8Array:
+ inputDescriptor.rawDepth = 'char';
+ break;
+ case Uint16Array:
+ inputDescriptor.rawDepth = 'ushort';
+ break;
+ case Int16Array:
+ inputDescriptor.rawDepth = 'short';
+ break;
+ case Uint32Array:
+ inputDescriptor.rawDepth = 'uint';
+ break;
+ case Int32Array:
+ inputDescriptor.rawDepth = 'int';
+ break;
+ case Float32Array:
+ inputDescriptor.rawDepth = 'float';
+ break;
+ case Float64Array:
+ inputDescriptor.rawDepth = 'double';
+ break;
+ default:
+ inputDescriptor.rawDepth = 'uchar';
+ break;
+ }
} else {
throw new Error('Expected width, height and channels for raw pixel input');
}
+ inputDescriptor.rawPremultiplied = false;
+ if (is.defined(inputOptions.raw.premultiplied)) {
+ if (is.bool(inputOptions.raw.premultiplied)) {
+ inputDescriptor.rawPremultiplied = inputOptions.raw.premultiplied;
+ } else {
+ throw is.invalidParameterError('raw.premultiplied', 'boolean', inputOptions.raw.premultiplied);
+ }
+ }
+ inputDescriptor.rawPageHeight = 0;
+ if (is.defined(inputOptions.raw.pageHeight)) {
+ if (is.integer(inputOptions.raw.pageHeight) && inputOptions.raw.pageHeight > 0 && inputOptions.raw.pageHeight <= inputOptions.raw.height) {
+ if (inputOptions.raw.height % inputOptions.raw.pageHeight !== 0) {
+ throw new Error(`Expected raw.height ${inputOptions.raw.height} to be a multiple of raw.pageHeight ${inputOptions.raw.pageHeight}`);
+ }
+ inputDescriptor.rawPageHeight = inputOptions.raw.pageHeight;
+ } else {
+ throw is.invalidParameterError('raw.pageHeight', 'positive integer', inputOptions.raw.pageHeight);
+ }
+ }
}
// Multi-page input (GIF, TIFF, PDF)
if (is.defined(inputOptions.animated)) {
@@ -123,14 +260,68 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
throw is.invalidParameterError('page', 'integer between 0 and 100000', inputOptions.page);
}
}
- // Multi-level input (OpenSlide)
- if (is.defined(inputOptions.level)) {
+ // OpenSlide specific options
+ if (is.object(inputOptions.openSlide) && is.defined(inputOptions.openSlide.level)) {
+ if (is.integer(inputOptions.openSlide.level) && is.inRange(inputOptions.openSlide.level, 0, 256)) {
+ inputDescriptor.openSlideLevel = inputOptions.openSlide.level;
+ } else {
+ throw is.invalidParameterError('openSlide.level', 'integer between 0 and 256', inputOptions.openSlide.level);
+ }
+ } else if (is.defined(inputOptions.level)) {
+ // Deprecated
if (is.integer(inputOptions.level) && is.inRange(inputOptions.level, 0, 256)) {
- inputDescriptor.level = inputOptions.level;
+ inputDescriptor.openSlideLevel = inputOptions.level;
} else {
throw is.invalidParameterError('level', 'integer between 0 and 256', inputOptions.level);
}
}
+ // TIFF specific options
+ if (is.object(inputOptions.tiff) && is.defined(inputOptions.tiff.subifd)) {
+ if (is.integer(inputOptions.tiff.subifd) && is.inRange(inputOptions.tiff.subifd, -1, 100000)) {
+ inputDescriptor.tiffSubifd = inputOptions.tiff.subifd;
+ } else {
+ throw is.invalidParameterError('tiff.subifd', 'integer between -1 and 100000', inputOptions.tiff.subifd);
+ }
+ } else if (is.defined(inputOptions.subifd)) {
+ // Deprecated
+ if (is.integer(inputOptions.subifd) && is.inRange(inputOptions.subifd, -1, 100000)) {
+ inputDescriptor.tiffSubifd = inputOptions.subifd;
+ } else {
+ throw is.invalidParameterError('subifd', 'integer between -1 and 100000', inputOptions.subifd);
+ }
+ }
+ // SVG specific options
+ if (is.object(inputOptions.svg)) {
+ if (is.defined(inputOptions.svg.stylesheet)) {
+ if (is.string(inputOptions.svg.stylesheet)) {
+ inputDescriptor.svgStylesheet = inputOptions.svg.stylesheet;
+ } else {
+ throw is.invalidParameterError('svg.stylesheet', 'string', inputOptions.svg.stylesheet);
+ }
+ }
+ if (is.defined(inputOptions.svg.highBitdepth)) {
+ if (is.bool(inputOptions.svg.highBitdepth)) {
+ inputDescriptor.svgHighBitdepth = inputOptions.svg.highBitdepth;
+ } else {
+ throw is.invalidParameterError('svg.highBitdepth', 'boolean', inputOptions.svg.highBitdepth);
+ }
+ }
+ }
+ // PDF specific options
+ if (is.object(inputOptions.pdf) && is.defined(inputOptions.pdf.background)) {
+ inputDescriptor.pdfBackground = this._getBackgroundColourOption(inputOptions.pdf.background);
+ } else if (is.defined(inputOptions.pdfBackground)) {
+ // Deprecated
+ inputDescriptor.pdfBackground = this._getBackgroundColourOption(inputOptions.pdfBackground);
+ }
+ // JPEG 2000 specific options
+ if (is.object(inputOptions.jp2) && is.defined(inputOptions.jp2.oneshot)) {
+ if (is.bool(inputOptions.jp2.oneshot)) {
+ inputDescriptor.jp2Oneshot = inputOptions.jp2.oneshot;
+ } else {
+ throw is.invalidParameterError('jp2.oneshot', 'boolean', inputOptions.jp2.oneshot);
+ }
+ }
// Create new image
if (is.defined(inputOptions.create)) {
if (
@@ -142,39 +333,50 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
inputDescriptor.createWidth = inputOptions.create.width;
inputDescriptor.createHeight = inputOptions.create.height;
inputDescriptor.createChannels = inputOptions.create.channels;
+ inputDescriptor.createPageHeight = 0;
+ if (is.defined(inputOptions.create.pageHeight)) {
+ if (is.integer(inputOptions.create.pageHeight) && inputOptions.create.pageHeight > 0 && inputOptions.create.pageHeight <= inputOptions.create.height) {
+ if (inputOptions.create.height % inputOptions.create.pageHeight !== 0) {
+ throw new Error(`Expected create.height ${inputOptions.create.height} to be a multiple of create.pageHeight ${inputOptions.create.pageHeight}`);
+ }
+ inputDescriptor.createPageHeight = inputOptions.create.pageHeight;
+ } else {
+ throw is.invalidParameterError('create.pageHeight', 'positive integer', inputOptions.create.pageHeight);
+ }
+ }
// Noise
if (is.defined(inputOptions.create.noise)) {
if (!is.object(inputOptions.create.noise)) {
throw new Error('Expected noise to be an object');
}
- if (!is.inArray(inputOptions.create.noise.type, ['gaussian'])) {
+ if (inputOptions.create.noise.type !== 'gaussian') {
throw new Error('Only gaussian noise is supported at the moment');
}
+ inputDescriptor.createNoiseType = inputOptions.create.noise.type;
if (!is.inRange(inputOptions.create.channels, 1, 4)) {
throw is.invalidParameterError('create.channels', 'number between 1 and 4', inputOptions.create.channels);
}
- inputDescriptor.createNoiseType = inputOptions.create.noise.type;
- if (is.number(inputOptions.create.noise.mean) && is.inRange(inputOptions.create.noise.mean, 0, 10000)) {
- inputDescriptor.createNoiseMean = inputOptions.create.noise.mean;
- } else {
- throw is.invalidParameterError('create.noise.mean', 'number between 0 and 10000', inputOptions.create.noise.mean);
+ inputDescriptor.createNoiseMean = 128;
+ if (is.defined(inputOptions.create.noise.mean)) {
+ if (is.number(inputOptions.create.noise.mean) && is.inRange(inputOptions.create.noise.mean, 0, 10000)) {
+ inputDescriptor.createNoiseMean = inputOptions.create.noise.mean;
+ } else {
+ throw is.invalidParameterError('create.noise.mean', 'number between 0 and 10000', inputOptions.create.noise.mean);
+ }
}
- if (is.number(inputOptions.create.noise.sigma) && is.inRange(inputOptions.create.noise.sigma, 0, 10000)) {
- inputDescriptor.createNoiseSigma = inputOptions.create.noise.sigma;
- } else {
- throw is.invalidParameterError('create.noise.sigma', 'number between 0 and 10000', inputOptions.create.noise.sigma);
+ inputDescriptor.createNoiseSigma = 30;
+ if (is.defined(inputOptions.create.noise.sigma)) {
+ if (is.number(inputOptions.create.noise.sigma) && is.inRange(inputOptions.create.noise.sigma, 0, 10000)) {
+ inputDescriptor.createNoiseSigma = inputOptions.create.noise.sigma;
+ } else {
+ throw is.invalidParameterError('create.noise.sigma', 'number between 0 and 10000', inputOptions.create.noise.sigma);
+ }
}
} else if (is.defined(inputOptions.create.background)) {
if (!is.inRange(inputOptions.create.channels, 3, 4)) {
throw is.invalidParameterError('create.channels', 'number between 3 and 4', inputOptions.create.channels);
}
- const background = color(inputOptions.create.background);
- inputDescriptor.createBackground = [
- background.red(),
- background.green(),
- background.blue(),
- Math.round(background.alpha() * 255)
- ];
+ inputDescriptor.createBackground = this._getBackgroundColourOption(inputOptions.create.background);
} else {
throw new Error('Expected valid noise or background to create a new input image');
}
@@ -183,8 +385,135 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
throw new Error('Expected valid width, height and channels to create a new input image');
}
}
+ // Create a new image with text
+ if (is.defined(inputOptions.text)) {
+ if (is.object(inputOptions.text) && is.string(inputOptions.text.text)) {
+ inputDescriptor.textValue = inputOptions.text.text;
+ if (is.defined(inputOptions.text.height) && is.defined(inputOptions.text.dpi)) {
+ throw new Error('Expected only one of dpi or height');
+ }
+ if (is.defined(inputOptions.text.font)) {
+ if (is.string(inputOptions.text.font)) {
+ inputDescriptor.textFont = inputOptions.text.font;
+ } else {
+ throw is.invalidParameterError('text.font', 'string', inputOptions.text.font);
+ }
+ }
+ if (is.defined(inputOptions.text.fontfile)) {
+ if (is.string(inputOptions.text.fontfile)) {
+ inputDescriptor.textFontfile = inputOptions.text.fontfile;
+ } else {
+ throw is.invalidParameterError('text.fontfile', 'string', inputOptions.text.fontfile);
+ }
+ }
+ if (is.defined(inputOptions.text.width)) {
+ if (is.integer(inputOptions.text.width) && inputOptions.text.width > 0) {
+ inputDescriptor.textWidth = inputOptions.text.width;
+ } else {
+ throw is.invalidParameterError('text.width', 'positive integer', inputOptions.text.width);
+ }
+ }
+ if (is.defined(inputOptions.text.height)) {
+ if (is.integer(inputOptions.text.height) && inputOptions.text.height > 0) {
+ inputDescriptor.textHeight = inputOptions.text.height;
+ } else {
+ throw is.invalidParameterError('text.height', 'positive integer', inputOptions.text.height);
+ }
+ }
+ if (is.defined(inputOptions.text.align)) {
+ if (is.string(inputOptions.text.align) && is.string(this.constructor.align[inputOptions.text.align])) {
+ inputDescriptor.textAlign = this.constructor.align[inputOptions.text.align];
+ } else {
+ throw is.invalidParameterError('text.align', 'valid alignment', inputOptions.text.align);
+ }
+ }
+ if (is.defined(inputOptions.text.justify)) {
+ if (is.bool(inputOptions.text.justify)) {
+ inputDescriptor.textJustify = inputOptions.text.justify;
+ } else {
+ throw is.invalidParameterError('text.justify', 'boolean', inputOptions.text.justify);
+ }
+ }
+ if (is.defined(inputOptions.text.dpi)) {
+ if (is.integer(inputOptions.text.dpi) && is.inRange(inputOptions.text.dpi, 1, 1000000)) {
+ inputDescriptor.textDpi = inputOptions.text.dpi;
+ } else {
+ throw is.invalidParameterError('text.dpi', 'integer between 1 and 1000000', inputOptions.text.dpi);
+ }
+ }
+ if (is.defined(inputOptions.text.rgba)) {
+ if (is.bool(inputOptions.text.rgba)) {
+ inputDescriptor.textRgba = inputOptions.text.rgba;
+ } else {
+ throw is.invalidParameterError('text.rgba', 'bool', inputOptions.text.rgba);
+ }
+ }
+ if (is.defined(inputOptions.text.spacing)) {
+ if (is.integer(inputOptions.text.spacing) && is.inRange(inputOptions.text.spacing, -1000000, 1000000)) {
+ inputDescriptor.textSpacing = inputOptions.text.spacing;
+ } else {
+ throw is.invalidParameterError('text.spacing', 'integer between -1000000 and 1000000', inputOptions.text.spacing);
+ }
+ }
+ if (is.defined(inputOptions.text.wrap)) {
+ if (is.string(inputOptions.text.wrap) && is.inArray(inputOptions.text.wrap, ['word', 'char', 'word-char', 'none'])) {
+ inputDescriptor.textWrap = inputOptions.text.wrap;
+ } else {
+ throw is.invalidParameterError('text.wrap', 'one of: word, char, word-char, none', inputOptions.text.wrap);
+ }
+ }
+ delete inputDescriptor.buffer;
+ } else {
+ throw new Error('Expected a valid string to create an image with text.');
+ }
+ }
+ // Join images together
+ if (is.defined(inputOptions.join)) {
+ if (is.defined(this.options.join)) {
+ if (is.defined(inputOptions.join.animated)) {
+ if (is.bool(inputOptions.join.animated)) {
+ inputDescriptor.joinAnimated = inputOptions.join.animated;
+ } else {
+ throw is.invalidParameterError('join.animated', 'boolean', inputOptions.join.animated);
+ }
+ }
+ if (is.defined(inputOptions.join.across)) {
+ if (is.integer(inputOptions.join.across) && is.inRange(inputOptions.join.across, 1, 1000000)) {
+ inputDescriptor.joinAcross = inputOptions.join.across;
+ } else {
+ throw is.invalidParameterError('join.across', 'integer between 1 and 100000', inputOptions.join.across);
+ }
+ }
+ if (is.defined(inputOptions.join.shim)) {
+ if (is.integer(inputOptions.join.shim) && is.inRange(inputOptions.join.shim, 0, 1000000)) {
+ inputDescriptor.joinShim = inputOptions.join.shim;
+ } else {
+ throw is.invalidParameterError('join.shim', 'integer between 0 and 100000', inputOptions.join.shim);
+ }
+ }
+ if (is.defined(inputOptions.join.background)) {
+ inputDescriptor.joinBackground = this._getBackgroundColourOption(inputOptions.join.background);
+ }
+ if (is.defined(inputOptions.join.halign)) {
+ if (is.string(inputOptions.join.halign) && is.string(this.constructor.align[inputOptions.join.halign])) {
+ inputDescriptor.joinHalign = this.constructor.align[inputOptions.join.halign];
+ } else {
+ throw is.invalidParameterError('join.halign', 'valid alignment', inputOptions.join.halign);
+ }
+ }
+ if (is.defined(inputOptions.join.valign)) {
+ if (is.string(inputOptions.join.valign) && is.string(this.constructor.align[inputOptions.join.valign])) {
+ inputDescriptor.joinValign = this.constructor.align[inputOptions.join.valign];
+ } else {
+ throw is.invalidParameterError('join.valign', 'valid alignment', inputOptions.join.valign);
+ }
+ }
+ } else {
+ throw new Error('Expected input to be an array of images to join');
+ }
+ }
} else if (is.defined(inputOptions)) {
- throw new Error('Invalid input options ' + inputOptions);
+ throw new Error(`Invalid input options ${inputOptions}`);
}
return inputDescriptor;
}
@@ -196,10 +525,8 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
* @param {string} encoding - unused
* @param {Function} callback
*/
-function _write (chunk, encoding, callback) {
- /* istanbul ignore else */
+function _write (chunk, _encoding, callback) {
if (Array.isArray(this.options.input.buffer)) {
- /* istanbul ignore else */
if (is.buffer(chunk)) {
if (this.options.input.buffer.length === 0) {
this.on('finish', () => {
@@ -236,25 +563,39 @@ function _isStreamInput () {
}
/**
- * Fast access to (uncached) image metadata without decoding any compressed image data.
+ * Fast access to (uncached) image metadata without decoding any compressed pixel data.
+ *
+ * This is read from the header of the input image.
+ * It does not take into consideration any operations to be applied to the output image,
+ * such as resize or rotate.
+ *
+ * Dimensions in the response will respect the `page` and `pages` properties of the
+ * {@link /api-constructor/ constructor parameters}.
+ *
* A `Promise` is returned when `callback` is not provided.
*
- * - `format`: Name of decoder used to decompress image data e.g. `jpeg`, `png`, `webp`, `gif`, `svg`
+ * - `format`: Name of decoder used to parse image e.g. `jpeg`, `png`, `webp`, `gif`, `svg`, `heif`, `tiff`
* - `size`: Total size of image in bytes, for Stream and Buffer input only
- * - `width`: Number of pixels wide (EXIF orientation is not taken into consideration)
- * - `height`: Number of pixels high (EXIF orientation is not taken into consideration)
- * - `space`: Name of colour space interpretation e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://libvips.github.io/libvips/API/current/VipsImage.html#VipsInterpretation)
+ * - `width`: Number of pixels wide (EXIF orientation is not taken into consideration, see example below)
+ * - `height`: Number of pixels high (EXIF orientation is not taken into consideration, see example below)
+ * - `space`: Name of colour space interpretation e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://www.libvips.org/API/current/enum.Interpretation.html)
* - `channels`: Number of bands e.g. `3` for sRGB, `4` for CMYK
- * - `depth`: Name of pixel depth format e.g. `uchar`, `char`, `ushort`, `float` [...](https://libvips.github.io/libvips/API/current/VipsImage.html#VipsBandFormat)
+ * - `depth`: Name of pixel depth format e.g. `uchar`, `char`, `ushort`, `float` [...](https://www.libvips.org/API/current/enum.BandFormat.html)
* - `density`: Number of pixels per inch (DPI), if present
* - `chromaSubsampling`: String containing JPEG chroma subsampling, `4:2:0` or `4:4:4` for RGB, `4:2:0:4` or `4:4:4:4` for CMYK
* - `isProgressive`: Boolean indicating whether the image is interlaced using a progressive scan
+ * - `isPalette`: Boolean indicating whether the image is palette-based (GIF, PNG).
+ * - `bitsPerSample`: Number of bits per sample for each channel (GIF, PNG, HEIF).
* - `pages`: Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP
* - `pageHeight`: Number of pixels high each page in a multi-page image will be.
* - `loop`: Number of times to loop an animated image, zero refers to a continuous loop.
* - `delay`: Delay in ms between each page in an animated image, provided as an array of integers.
* - `pagePrimary`: Number of the primary page in a HEIF image
* - `levels`: Details of each level in a multi-level image provided as an array of objects, requires libvips compiled with support for OpenSlide
+ * - `subifds`: Number of Sub Image File Directories in an OME-TIFF image
+ * - `background`: Default background colour, if present, for PNG (bKGD) and GIF images
+ * - `compression`: The encoder used to compress an HEIF file, `av1` (AVIF) or `hevc` (HEIC)
+ * - `resolutionUnit`: The unit of resolution (density), either `inch` or `cm`, if present
* - `hasProfile`: Boolean indicating the presence of an embedded ICC profile
* - `hasAlpha`: Boolean indicating the presence of an alpha transparency channel
* - `orientation`: Number value of the EXIF Orientation header, if present
@@ -262,7 +603,13 @@ function _isStreamInput () {
* - `icc`: Buffer containing raw [ICC](https://www.npmjs.com/package/icc) profile data, if present
* - `iptc`: Buffer containing raw IPTC data, if present
* - `xmp`: Buffer containing raw XMP data, if present
+ * - `xmpAsString`: String containing XMP data, if valid UTF-8.
* - `tifftagPhotoshop`: Buffer containing raw TIFFTAG_PHOTOSHOP data, if present
+ * - `formatMagick`: String containing format for images loaded via *magick
+ * - `comments`: Array of keyword/text pairs representing PNG text blocks, if present.
+ *
+ * @example
+ * const metadata = await sharp(input).metadata();
*
* @example
* const image = sharp(inputJpg);
@@ -278,39 +625,62 @@ function _isStreamInput () {
* // data contains a WebP image half the width and height of the original JPEG
* });
*
+ * @example
+ * // Get dimensions taking EXIF Orientation into account.
+ * const { autoOrient } = await sharp(input).metadata();
+ * const { width, height } = autoOrient;
+ *
* @param {Function} [callback] - called with the arguments `(err, metadata)`
* @returns {Promise