Compare commits

..

129 Commits

Author SHA1 Message Date
Lovell Fuller
17d4a684df WIP: Switch from custom VError to standard runtime_error 2026-01-23 22:26:15 +00:00
Lovell Fuller
ed6b7384d0 Ensure TIFF output bitdepth option is limited to 1, 2 or 4 2026-01-23 21:29:40 +00:00
Lovell Fuller
ef77388a73 Force MSVC to use exception handling
As of 8.18.0, libvips C++ wrapper retrieves error messages at
exception construction time rather than lazily when accessed.

On Windows this led to error messages being referenced rather
than copied, leading to access beyond their lifetime and possible
corruption.
2026-01-22 12:52:48 +00:00
Lovell Fuller
66764b359b Remove unused option parameter added in 8561f0d 2026-01-20 21:10:56 +00:00
Lovell Fuller
8561f0da1d Ensure HEIF primary item is used as default page #4487 2026-01-18 20:24:34 +00:00
Lovell Fuller
0468c1be9f Encoding lossless AVIF is mutually exclusive with iq tuning 2026-01-08 12:43:53 +00:00
Lovell Fuller
4b1680c312 Prerelease v0.35.0-rc.0 2026-01-02 11:12:47 +00:00
Lovell Fuller
2346722c0d Upgrade sharp-libvips to v1.3.0-rc.2 2026-01-02 10:58:18 +00:00
Dmytro Tiapukhin
a5e726002c Add margin option to trim operation #4480 2026-01-02 09:33:40 +00:00
Lovell Fuller
d161e45e06 TypeScript: Ensure 'FormatEnum' keys match reality #4475
Renames format.jp2k as format.jp2 for consistency
2026-01-02 08:04:46 +00:00
Lovell Fuller
006d37b2d0 Add AVIF/HEIF 'tune' option to control quality metrics #4227 2026-01-01 22:41:42 +00:00
Lovell Fuller
0d872bd13a Add WebP 'exact' option for control over transparent pixels 2026-01-01 19:19:20 +00:00
Lovell Fuller
1cf4b7f04d Deprecate win32-ia32 prebuilt binaries 2025-12-31 10:16:09 +00:00
Lovell Fuller
e50c0c2e04 CI: Migrate FreeBSD from Cirrus to GitHub Actions 2025-12-31 09:48:59 +00:00
Lovell Fuller
3278a9a913 CI: Pin win32-ia32 Node.js 22 version
There seems to be an Error message string corruption problem in
the latest 22.21.1.
2025-12-30 19:35:51 +00:00
Lovell Fuller
1b2f79335d Remove previously-deprecated properties from API 2025-12-29 13:04:27 +00:00
Lovell Fuller
937167933b Docs: Add list of well-maintained Lambda Layers 2025-12-27 09:03:44 +00:00
Lovell Fuller
dbcb7e60bd Add toUint8Array for output backed by transferable ArrayBuffer #4355 2025-12-23 18:19:01 +00:00
Lovell Fuller
e1bad5470e Remove install script, building from source is now opt-in
The vast majority of people don't need this. Package managers
are (correctly) starting to block install scripts by default,
so this change should reduce install-time warnings.
2025-12-21 12:36:40 +00:00
Lovell Fuller
1a2c1c8833 Add version to shared library filename to help avoid collision 2025-12-21 12:00:30 +00:00
Lovell Fuller
aaeded2b67 Add withGainMap to process HDR JPEGs with embedded gain map #4314 2025-12-19 15:41:09 +00:00
Lovell Fuller
f6cdd36559 Bump devDeps 2025-12-18 22:47:14 +00:00
Lovell Fuller
283c7d3f0c Drop Node.js 18, now requires Node.js >= 20.9.0 2025-12-17 15:08:34 +00:00
Lovell Fuller
34c39fa194 Upgrade to libvips v8.18.0-rc.2 2025-12-17 13:26:51 +00:00
Lovell Fuller
7b4c476243 CI: Update to latest FreeBSD 16 2025-12-16 19:59:31 +00:00
Lovell Fuller
084a30f8bf Docs: clarify metadata 'format' property #4483 2025-12-10 15:38:14 +00:00
Kleis Auke Wolthuizen
3609c61a22 Tests: fix JP2 suite with global libvips (#4477) 2025-11-15 10:55:58 +00:00
Jiralite
dc6820b49f TypeScript: tag deprecated constructor properties (#4474) 2025-11-10 16:41:22 +00:00
Sylvester Keil
f2a49d19c9 Fix invalid escape sequence (#4471) 2025-11-07 11:39:39 +00:00
Lovell Fuller
e062456868 Release v0.34.5 2025-11-06 14:06:31 +00:00
Lovell Fuller
6450c704a6 Prerelease v0.34.5-rc.1 2025-11-06 11:34:00 +00:00
Lovell Fuller
f7c95d1bf0 TypeScript: consolidate a few enum-like properties 2025-11-06 11:15:28 +00:00
Lovell Fuller
ef86a75560 Prerelease v0.34.5-rc.0 2025-11-05 15:41:31 +00:00
Lovell Fuller
6c1e840098 Use structured binding for tuples where possible 2025-11-05 15:30:52 +00:00
Lovell Fuller
e1628d8ef5 Simplify ICC processing when retaining input profiles #4468
Takes advantage of libvips' improved ICC handling
2025-11-04 15:06:49 +00:00
Lovell Fuller
4f9f8179a6 Linter: apply all recommended biome settings
Enforces previously-skipped useArrowFunction check
2025-11-04 09:41:45 +00:00
Lovell Fuller
09d5aa8cfa Docs: update internal and libvips doc links 2025-11-02 14:38:22 +00:00
Lovell Fuller
040b73ca74 Upgrade to libvips v8.17.3 2025-11-01 12:23:32 +00:00
Lovell Fuller
1f2f33d9a7 Ensure licensing headers are retained by code bundlers 2025-10-31 11:52:41 +00:00
Kleis Auke Wolthuizen
69b2c45615 Tests: migrate text suite to async (#4466) 2025-10-27 16:21:37 +00:00
Lovell Fuller
9e4e184132 Add experimental support for prebuilt linux-riscv64 binaries 2025-10-19 11:56:45 +01:00
Lovell Fuller
206eb4a89a Limit colour strings to 200 chars, helps reduce effect of potential ReDoS 2025-10-18 14:52:17 +01:00
Lovell Fuller
c1c16ed3e6 Improve error messaging when only warnings issued #4465 2025-10-17 14:57:38 +01:00
Lovell Fuller
b7fda60a85 Bump deps 2025-10-17 14:56:17 +01:00
Lovell Fuller
1bbee519aa Separate build script from install script #4458
The --build-from-source flag is now deprecated and will soon
be removed along with the need to define an install script.

This will remove a whole category of package manager
warnings about install scripts and "built" dependencies.

Most people don't need to build sharp from source, but for
those that do, a suitable method is now something like:

$ npm install package-that-depends-on-sharp
$ npm explore sharp -- npm run build
2025-10-07 16:11:54 +01:00
Lovell Fuller
2324d75f7f CI: Upgrade to macOS 15 (Sequoia) 2025-10-05 11:28:58 +01:00
Lovell Fuller
5e72ad95fa Docs: changelog entry for #4459 2025-09-30 10:54:00 +01:00
throwbi
6b922b30d5 Add support for BigTIFF output (#4459) 2025-09-30 09:41:02 +01:00
Lovell Fuller
54722dd582 Modernise C++ linter using new @cpplint/cli tooling 2025-09-22 14:59:52 +01:00
Lovell Fuller
adb6275ae9 Remove licensing checker/linter
This tool appears to no longer be maintained, but more
importantly there are far fewer production dependencies now
than when first introduced, and all are known/trusted.
2025-09-21 12:11:02 +01:00
Lovell Fuller
f2978651f0 Migrate from mocha to Node.js native test runner
Includes coverage reports when using Node.js 22 onwards
2025-09-21 12:03:27 +01:00
Kleis Auke Wolthuizen
c446d743a2 Docs: libvips manages its own thread pool (#4455) 2025-09-20 13:03:38 +01:00
Lovell Fuller
3498eb63e3 Docs: partially-revert 3009957, fix link to glibc malloc tunables 2025-09-20 10:47:43 +01:00
Lovell Fuller
3009957120 Docs: Add note about libvips thread pool sizing 2025-09-19 13:13:53 +01:00
Lovell Fuller
b36237ddcb Switch linter from semistandard to biome
Uses the recommended rules apart from complexity/useArrowFunction,
which would affect about 1700 lines of code with little benefit
right now. This is something that can be addressed over time.
2025-09-18 21:18:31 +01:00
Lovell Fuller
a0af662d78 CI: Separate platform-independent linter tasks
Run these before platform-specific build/testing tasks
2025-09-18 13:21:03 +01:00
Lovell Fuller
ee437832e2 Release v0.34.4 2025-09-17 13:57:10 +01:00
Lovell Fuller
529901177b CI/Docs: Deno v2 support 2025-09-17 13:56:49 +01:00
Lovell Fuller
4710092b2a Prerelease v0.34.4-rc.4 2025-09-17 12:53:47 +01:00
Lovell Fuller
ed1ac43e55 CI: Upgrade packaging test dependencies 2025-09-17 12:11:06 +01:00
Lovell Fuller
dfcbceee4b Upgrade sharp-libvips to v1.2.3 2025-09-17 12:10:36 +01:00
Lovell Fuller
35d3f56c67 Ensure TIFF subifd and OpenSlide level are respected
Fixes regression introduced in 852c7f8
2025-09-16 08:44:08 +01:00
Lovell Fuller
9f4bace03b Prerelease v0.34.4-rc.3 2025-09-15 11:18:53 +01:00
Lovell Fuller
b507831a11 CI: Remove dry-run flag
This was temporary whilst setting up auto-publish
2025-09-15 11:18:00 +01:00
Lovell Fuller
905f69837e Prerelease v0.34.4-rc.2 2025-09-15 10:13:47 +01:00
Lovell Fuller
b0154ed83c Upgrade sharp-libvips to v1.2.2 2025-09-15 10:01:04 +01:00
Lovell Fuller
93b814f849 Upgrade to libvips v8.17.2 2025-09-14 12:23:16 +01:00
Lovell Fuller
6d4d44e2fa Docs: improve FreeBSD build-from-source install help 2025-09-13 13:37:35 +01:00
Lovell Fuller
d8686e7c64 Ensure Electron support for images with XMP metadata #4451 2025-09-12 12:33:59 +01:00
Lovell Fuller
23a0e81d98 Docs: changelog and credit for #4452 2025-09-12 11:50:16 +01:00
Maël Nison
43b579c903 Add sharp-libvips rpath for yarn v5 support (#4452)
This should future proof sharp against upcoming
changes in yarn's plug-n-play filesystem layout.
2025-09-12 11:15:04 +01:00
Lovell Fuller
45f8717900 Upgrade color to latest version via CommonJS wrapper package
Allows continued support of non-ESM runtimes - see #4450
2025-09-10 09:21:14 +01:00
Lovell Fuller
c270455007 Bump deps 2025-09-10 08:43:47 +01:00
Lovell Fuller
1835288ab8 Docs: remove frame clutter from code samples 2025-09-08 11:10:51 +01:00
Lovell Fuller
c1e33de33c CI: Automate npm publish-with-provenance
Temporarily flagged with dry-run for now
2025-09-01 12:37:16 +01:00
Lovell Fuller
0e4b648593 Ensure unlimited flag is passed to tiffload #4446 2025-08-29 23:29:24 +01:00
Kleis Auke Wolthuizen
40be212bba Use modern -s command line lists
See: emscripten-core/emscripten@bb615a9
2025-08-29 09:37:59 +01:00
Kleis Auke Wolthuizen
8ceeda9ae9 Remove -sNODEJS_CATCH_EXIT=0 linker flag
Disabled by default since Emscripten 3.1.65, see commit:
emscripten-core/emscripten@cd831e7
2025-08-29 09:37:59 +01:00
Kleis Auke Wolthuizen
16e248f93e Remove -sWASM_BIGINT linker flag
Enabled by default since Emscripten 4.0.0, see commit:
emscripten-core/emscripten@93d2f8d
2025-08-29 09:37:59 +01:00
Kleis Auke Wolthuizen
b77c97067a Remove -sTEXTDECODER=0 linker flag
See: emscripten-core/emscripten@b490c44
2025-08-29 09:37:59 +01:00
Lovell Fuller
660bbdb1c0 Docs: changelog for #4441 2025-08-22 20:01:46 +01:00
Lovell Fuller
4164705113 Bump devDeps 2025-08-22 20:01:18 +01:00
Bayan Bennett
c01e272db5 TypeScript: Ensure KernelEnum includes linear (#4441) 2025-08-21 09:35:41 +01:00
Lovell Fuller
8607ff2f4a Tests: remove extraneous use of toColourspace 2025-08-18 10:33:32 +01:00
Lovell Fuller
cd337e4de3 Docs: extractChannel output colourspace is b-w or grey16 2025-08-18 10:24:55 +01:00
Lovell Fuller
51d1a49abc v0.34.4-rc.1 2025-07-28 14:32:52 +01:00
Lovell Fuller
dda00f63e6 CI: Remove frontmatter from release notes 2025-07-28 11:34:31 +01:00
Lovell Fuller
9e20a25c5d Prerelease v0.34.4-rc.0 2025-07-25 10:44:00 +01:00
Lovell Fuller
fefda85d2d CI: Upgrade to Debian 12 for ppc64 and s390x
Debian 11 has reached EOL on these platforms
2025-07-24 17:29:38 +01:00
Lovell Fuller
e045235545 Upgrade to sharp-libvips v1.2.1 2025-07-24 16:51:28 +01:00
Lovell Fuller
08b4242efe Ensure autoOrient occurs before non-90 rotation #4425
- Separate orient vs rotate ordering logic
- Simplify EXIF auto-orient by using only rotate and/or flop
2025-07-21 16:10:37 +01:00
Lovell Fuller
67462bee79 CI: Simplify volume mappings for linuxmusl-arm64 runners 2025-07-19 14:45:07 +01:00
Lovell Fuller
628454559e Ensure autoOrient removes metadata after shrink-on-load #4431 2025-07-19 14:00:42 +01:00
Lovell Fuller
ecfc77c185 Docs: split changelog into per-release files
Use these as the body for (future) GitHub releases
2025-07-15 17:21:09 +01:00
Kleis Auke Wolthuizen
6cde18d443 Remove redundant TIFF warning handler setup (#4422)
This became redundant after commit libvips/libvips@22994d9.
2025-07-10 14:57:04 +01:00
Lovell Fuller
276ac2df8d Release v0.34.3 2025-07-10 08:34:49 +01:00
Lovell Fuller
2dedcf35a0 Prerelease v0.34.3-rc.1 2025-07-09 21:14:50 +01:00
Lovell Fuller
92f21451c1 Upgrade to sharp-libvips v1.2.0 2025-07-08 21:58:53 +01:00
Lovell Fuller
2cd2f8430a Upgrade to libvips v8.17.1 2025-07-08 08:36:44 +01:00
Lovell Fuller
8ee8d273ee Provide XMP as a string, as well as a Buffer, where possible 2025-07-04 15:56:09 +01:00
Thibaut Patel
4e3f3792ad Add keepXmp and withXmp for control over output XMP metadata #4416 2025-07-04 15:20:32 +01:00
Lovell Fuller
df5454e7dc Add support for RAW digicam input, requires custom libvips+libraw 2025-06-30 12:14:06 +01:00
Lovell Fuller
32cf6be1b8 Docs: update benchmark results ahead of v0.34.3 2025-06-26 14:49:36 +01:00
Lovell Fuller
96dfd400b2 Tests: update benchmark environment 2025-06-26 11:16:54 +01:00
Lovell Fuller
1422798c1d Upgrade to sharp-libvips v1.2.0-rc.3 2025-06-24 13:11:12 +01:00
Lovell Fuller
e26d4e9d5b Add pageHeight param to create/new for animated input #3236 2025-06-21 11:33:52 +01:00
Lovell Fuller
852c7f8663 Clean up internal naming of format-specific input options 2025-06-17 13:24:55 +01:00
Lovell Fuller
e286e2bff9 Build format-specific input options in a single function 2025-06-17 10:15:40 +01:00
Kleis Auke Wolthuizen
76995deefa Ensure SVG scale-on-load optimisation uses newly exposed params (#4415)
Follow-up to commit c4b1d80.
2025-06-16 15:45:19 +01:00
Lovell Fuller
e688c53659 Docs: expand info about parallelism and concurrency control #4411 2025-06-16 12:02:09 +01:00
Lovell Fuller
c4b1d80c35 Expose stylesheet and highBitdepth SVG input params 2025-06-16 11:11:02 +01:00
Lovell Fuller
f92540f134 Nest format-specific constructor params (deprecate at top-level)
- `subifd` -> `tiff.subifd`
- `level` -> `openSlide.level`
- `pdfBackground` -> `pdf.background`
2025-06-16 07:51:36 +01:00
Lovell Fuller
8c53d499f7 Expose keepDuplicateFrames GIF output parameter 2025-06-15 15:39:01 +01:00
Lovell Fuller
9392b8702b Add Magic Kernel Sharp (no relation) to resizing kernels 2025-06-15 12:53:10 +01:00
Lovell Fuller
8669fbc936 Prerelease v0.34.3-rc.0 2025-06-14 21:49:24 +01:00
Lovell Fuller
cab02463ec Remove prebuild dependency
Every CI build task tagged with 'package' now populates and
publishes the relevant npm/platform directory as an artefact.
These are aggregated by a fan-in release task at the end to
create a complete npm workspace zipfile. If the commit is
tagged, a release is created and the npm workspace attached.
2025-06-14 17:49:17 +01:00
Lovell Fuller
5374b036f3 CI: Switch ARM64 from CircleCI to GitHub Actions 2025-06-13 14:08:19 +01:00
Kleis Auke Wolthuizen
327a6d2083 Docs: update link to concurrency API (#4414) 2025-06-13 10:48:32 +01:00
Michael B. Klein
751f9992c4 Expose JPEG 2000 oneshot decoder option #4262
Requires libvips compiled with support for JP2 images

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
2025-06-13 08:46:36 +01:00
Lovell Fuller
01f6cbbaee Upgrade to sharp-libvips v1.2.0-rc.2 2025-06-12 14:59:13 +01:00
Lovell Fuller
99be893dd4 Upgrade to libvips v8.17.0
CI: Use more recent, non-deprecated Windows runners

Bump devDeps
2025-06-12 11:27:26 +01:00
Kleis Auke Wolthuizen
4d1f7e051d Support composite op with non-sRGB pipeline colourspace (#4412) 2025-06-12 10:32:24 +01:00
Kleis Auke Wolthuizen
91f1b58f31 Tests: Regenerate expected fixtures ahead of libvips v8.17.0 (#4402) 2025-06-08 23:31:07 +01:00
Lovell Fuller
6d04b7c1fa Release v0.34.2 2025-05-20 14:36:42 +01:00
Harshal Bhakta
d4b30b7392 Docs: Update pnpm settings documentation URLs 2025-05-20 13:57:15 +01:00
Lovell Fuller
7f03502003 Docs: upgrade to latest Astro Starlight 2025-05-20 12:57:28 +01:00
Lovell Fuller
63b0a11b5b Tests: remove a possible race condition 2025-05-19 23:21:55 +01:00
Lovell Fuller
c4d6aec48c Docs: Highlight that Windows ARM64 support is experimental 2025-05-19 22:04:08 +01:00
Lovell Fuller
e75ae970ed Ensure PDF scale-on-load optimisation uses background #4398 2025-05-16 14:38:00 +01:00
261 changed files with 7673 additions and 5941 deletions

View File

@@ -1,105 +0,0 @@
version: 2.1
workflows:
build:
jobs:
- linux-arm64-glibc-node-18:
filters:
tags:
only: /^v.*/
- linux-arm64-musl-node-18:
filters:
tags:
only: /^v.*/
- linux-arm64-glibc-node-20:
filters:
tags:
only: /^v.*/
- linux-arm64-musl-node-20:
filters:
tags:
only: /^v.*/
jobs:
linux-arm64-glibc-node-18:
resource_class: arm.medium
machine:
image: ubuntu-2204:current
steps:
- checkout
- run: |
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 fonts-noto-core"
sudo docker exec sharp sh -c "mkdir -p /etc/apt/keyrings"
sudo docker exec sharp sh -c "curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg"
sudo docker exec sharp sh -c "echo 'deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main' | tee /etc/apt/sources.list.d/nodesource.list"
sudo docker exec sharp sh -c "apt-get update && apt-get install -y nodejs"
- run: sudo docker exec sharp sh -c "npm install --build-from-source"
- run: sudo docker exec sharp sh -c "npm test"
- run: |
sudo docker exec sharp sh -c "npm run package-from-local-build"
sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@img/sharp-linux-arm64=file:./npm/linux-arm64\""
sudo docker exec sharp sh -c "npm run clean"
sudo docker exec sharp sh -c "npm install --ignore-scripts"
sudo docker exec sharp sh -c "npm test"
- run: "[[ -n $CIRCLE_TAG ]] && sudo docker exec --env prebuild_upload sharp sh -c \"cd src && ln -s ../package.json && npx prebuild --upload=$prebuild_upload\" || true"
linux-arm64-glibc-node-20:
resource_class: arm.medium
machine:
image: ubuntu-2204:current
steps:
- checkout
- run: |
sudo docker run -dit --name 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 fonts-noto-core"
sudo docker exec sharp sh -c "mkdir -p /etc/apt/keyrings"
sudo docker exec sharp sh -c "curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg"
sudo docker exec sharp sh -c "echo 'deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main' | tee /etc/apt/sources.list.d/nodesource.list"
sudo docker exec sharp sh -c "apt-get update && apt-get install -y nodejs"
sudo docker exec sharp sh -c "mkdir -p /mnt/sharp"
sudo docker cp . sharp:/mnt/sharp/.
- run: sudo docker exec sharp sh -c "npm install --build-from-source"
- run: sudo docker exec sharp sh -c "npm test"
- run: |
sudo docker exec sharp sh -c "npm run package-from-local-build"
sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@img/sharp-linux-arm64=file:./npm/linux-arm64\""
sudo docker exec sharp sh -c "npm run clean"
sudo docker exec sharp sh -c "npm install --ignore-scripts"
sudo docker exec sharp sh -c "npm test"
linux-arm64-musl-node-18:
resource_class: arm.medium
machine:
image: ubuntu-2204:current
steps:
- checkout
- run: |
sudo docker run -dit --name sharp --volume "${PWD}:/mnt/sharp" --workdir /mnt/sharp node:18-alpine3.17
sudo docker exec sharp sh -c "apk add build-base git python3 font-noto --update-cache"
- run: sudo docker exec sharp sh -c "npm install --build-from-source"
- run: sudo docker exec sharp sh -c "npm test"
- run: |
sudo docker exec sharp sh -c "npm run package-from-local-build"
sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@img/sharp-linuxmusl-arm64=file:./npm/linuxmusl-arm64\""
sudo docker exec sharp sh -c "npm run clean"
sudo docker exec sharp sh -c "npm install --ignore-scripts"
sudo docker exec sharp sh -c "npm test"
- run: "[[ -n $CIRCLE_TAG ]] && sudo docker exec --env prebuild_upload sharp sh -c \"cd src && ln -s ../package.json && npx prebuild --upload=$prebuild_upload\" || true"
linux-arm64-musl-node-20:
resource_class: arm.medium
machine:
image: ubuntu-2204:current
steps:
- checkout
- run: |
sudo docker run -dit --name sharp --workdir /mnt/sharp node:20-alpine3.18
sudo docker exec sharp sh -c "apk add build-base git python3 font-noto --update-cache"
sudo docker exec sharp sh -c "mkdir -p /mnt/sharp"
sudo docker cp . sharp:/mnt/sharp/.
- run: sudo docker exec sharp sh -c "npm install --build-from-source"
- run: sudo docker exec sharp sh -c "npm test"
- run: |
sudo docker exec sharp sh -c "npm run package-from-local-build"
sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@img/sharp-linuxmusl-arm64=file:./npm/linuxmusl-arm64\""
sudo docker exec sharp sh -c "npm run clean"
sudo docker exec sharp sh -c "npm install --ignore-scripts"
sudo docker exec sharp sh -c "npm test"

View File

@@ -1,17 +0,0 @@
freebsd_instance:
image_family: freebsd-14-0-snap
task:
name: FreeBSD
env:
IGNORE_OSVERSION: yes
skip_notifications: true
prerequisites_script:
- pkg update -f
- pkg upgrade -y
- pkg install -y devel/git devel/pkgconf graphics/vips www/node20 www/npm
- pkg-config --modversion vips-cpp
install_script:
- npm install --build-from-source
test_script:
- npx mocha --no-config --spec=test/unit/io.js --timeout=30000

View File

@@ -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

View File

@@ -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,7 +14,7 @@ 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://www.libvips.org/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
@@ -27,12 +25,11 @@ Please select the `main` branch as the destination for your Pull Request so your
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/main/test/unit) to cover your new feature.
A test coverage report for the JavaScript code is generated in the `coverage/lcov-report` directory.
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

View File

@@ -31,7 +31,7 @@ please open an issue against that package instead.
<!-- Please place an [x] in the relevant box to confirm. -->
- [ ] I am using Node.js with a version that satisfies `^18.17.0 || ^20.3.0 || >=21.0.0`
- [ ] I am using Node.js with a version that satisfies `>=20.9.0`
- [ ] I am using Deno
- [ ] I am using Bun

View File

@@ -4,10 +4,24 @@ on:
- pull_request
permissions: {}
jobs:
github-runner:
lint:
permissions:
contents: write
name: ${{ matrix.platform }} - Node.js ${{ matrix.nodejs_version_major }} ${{ matrix.prebuild && '- prebuild' }}
contents: read
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
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:
@@ -17,220 +31,300 @@ jobs:
- os: ubuntu-24.04
container: rockylinux:8
nodejs_arch: x64
nodejs_version: "^18.17.0"
nodejs_version_major: 18
platform: linux-x64
prebuild: true
- os: ubuntu-24.04
container: rockylinux:8
nodejs_arch: x64
nodejs_version: "^20.3.0"
nodejs_version: "^20.9.0"
nodejs_version_major: 20
platform: linux-x64
package: true
- os: ubuntu-24.04
container: rockylinux:8
nodejs_arch: x64
nodejs_version: "^22.9.0"
nodejs_version: "^22"
nodejs_version_major: 22
platform: linux-x64
- os: ubuntu-24.04
container: node:18-alpine3.17
nodejs_version_major: 18
platform: linuxmusl-x64
prebuild: true
container: rockylinux:8
nodejs_arch: x64
nodejs_version: "^24"
nodejs_version_major: 24
platform: linux-x64
- os: ubuntu-24.04
container: node:20-alpine3.18
nodejs_version_major: 20
platform: linuxmusl-x64
package: true
- os: ubuntu-24.04
container: node:22-alpine3.20
nodejs_version_major: 22
platform: linuxmusl-x64
- os: macos-13
- os: ubuntu-24.04
container: node:24-alpine3.22
nodejs_version_major: 24
platform: linuxmusl-x64
- os: ubuntu-24.04-arm
container: arm64v8/rockylinux:8
nodejs_arch: arm64
nodejs_version: "^20.9.0"
nodejs_version_major: 20
platform: linux-arm64
package: true
- os: ubuntu-24.04-arm
container: arm64v8/rockylinux:8
nodejs_arch: arm64
nodejs_version: "^22"
nodejs_version_major: 22
platform: linux-arm64
- os: ubuntu-24.04-arm
container: arm64v8/rockylinux:8
nodejs_arch: arm64
nodejs_version: "^24"
nodejs_version_major: 24
platform: linux-arm64
- os: macos-15-intel
nodejs_arch: x64
nodejs_version: "^18.17.0"
nodejs_version_major: 18
platform: darwin-x64
prebuild: true
- os: macos-13
nodejs_arch: x64
nodejs_version: "^20.3.0"
nodejs_version: "^20.9.0"
nodejs_version_major: 20
platform: darwin-x64
- os: macos-13
package: true
- os: macos-15-intel
nodejs_arch: x64
nodejs_version: "^22.9.0"
nodejs_version: "^22"
nodejs_version_major: 22
platform: darwin-x64
- os: macos-14
- os: macos-15-intel
nodejs_arch: x64
nodejs_version: "^24"
nodejs_version_major: 24
platform: darwin-x64
- os: macos-15
nodejs_arch: arm64
nodejs_version: "^18.17.0"
nodejs_version_major: 18
platform: darwin-arm64
prebuild: true
- os: macos-14
nodejs_arch: arm64
nodejs_version: "^20.3.0"
nodejs_version: "^20.9.0"
nodejs_version_major: 20
platform: darwin-arm64
- os: macos-14
package: true
- os: macos-15
nodejs_arch: arm64
nodejs_version: "^22.9.0"
nodejs_version: "^22"
nodejs_version_major: 22
platform: darwin-arm64
- os: windows-2019
- os: macos-15
nodejs_arch: arm64
nodejs_version: "^24"
nodejs_version_major: 24
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
prebuild: true
- os: windows-2019
nodejs_arch: x86
nodejs_version: "^20.3.0"
nodejs_version: "^20.9.0"
nodejs_version_major: 20
platform: win32-ia32
- os: windows-2019
nodejs_arch: x86
nodejs_version: "^22.9.0"
nodejs_version_major: 22
platform: win32-ia32
- os: windows-2019
package: true
- os: windows-2022
nodejs_arch: x64
nodejs_version: "^18.17.0"
nodejs_version_major: 18
platform: win32-x64
prebuild: true
- os: windows-2019
nodejs_arch: x64
nodejs_version: "^20.3.0"
nodejs_version: "^20.9.0"
nodejs_version_major: 20
platform: win32-x64
- os: windows-2019
package: true
- os: windows-2022
nodejs_arch: x64
nodejs_version: "^22.9.0"
nodejs_version: "^22"
nodejs_version_major: 22
platform: win32-x64
- os: windows-2022
nodejs_arch: x64
nodejs_version: "^24"
nodejs_version_major: 24
platform: win32-x64
- os: windows-11-arm
nodejs_arch: arm64
nodejs_version: "^20.3.0"
nodejs_version: "^20.9.0"
nodejs_version_major: 20
platform: win32-arm64
prebuild: true
package: true
- os: windows-11-arm
nodejs_arch: arm64
nodejs_version: "^22.9.0"
nodejs_version: "^22"
nodejs_version_major: 22
platform: win32-arm64
- os: windows-11-arm
nodejs_arch: arm64
nodejs_version: "^24"
nodejs_version_major: 24
platform: win32-arm64
steps:
- name: Dependencies (Rocky Linux glibc)
if: contains(matrix.container, 'rockylinux')
run: |
dnf install -y gcc-toolset-11-gcc-c++ make git python3.12 fontconfig google-noto-sans-fonts
echo "/opt/rh/gcc-toolset-11/root/usr/bin" >> $GITHUB_PATH
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 font-noto --update-cache
- name: Dependencies (Python 3.11 - macOS, Windows)
if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows')
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Dependencies (Node.js)
if: "!contains(matrix.platform, 'linuxmusl')"
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.nodejs_version }}
architecture: ${{ matrix.nodejs_arch }}
- name: Checkout
uses: actions/checkout@v4
- name: Install
run: npm install --build-from-source
- name: Test
run: npm test
- name: Test packaging
run: |
npm run package-from-local-build
npm pkg set "optionalDependencies.@img/sharp-${{ matrix.platform }}=file:./npm/${{ matrix.platform }}"
npm run clean
npm install --ignore-scripts
npm test
- name: Prebuild
if: matrix.prebuild && startsWith(github.ref, 'refs/tags/')
env:
prebuild_upload: ${{ secrets.GITHUB_TOKEN }}
run: |
node -e "require('fs').cpSync('package.json', 'src/package.json')"
cd src
npx prebuild
github-runner-qemu:
- uses: actions/checkout@v6
- 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@v6
if: matrix.package
with:
name: ${{ matrix.platform }}
path: npm/${{ matrix.platform }}
retention-days: 1
if-no-files-found: error
build-linuxmusl-arm64:
permissions:
contents: write
name: ${{ matrix.platform }} - Node.js ${{ matrix.nodejs_version_major }} - prebuild
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/node24:ro,rshared
strategy:
fail-fast: false
matrix:
include:
- container: node:20-alpine3.20
nodejs_version_major: 20
package: true
- container: node:22-alpine3.20
nodejs_version_major: 22
- container: node:24-alpine3.22
nodejs_version_major: 24
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@v6
- 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@v6
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
distro: bullseye
run_on_arch: armv6
base_image: "balenalib/rpi-raspbian:bullseye"
nodejs_arch: armv6l
nodejs_hostname: unofficial-builds.nodejs.org
nodejs_version: "18.17.0"
nodejs_version_major: 18
nodejs_version: "20.9.0"
nodejs_version_major: 20
- platform: linux-s390x
distro: bullseye
run_on_arch: 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
nodejs_version: "20.9.0"
nodejs_version_major: 20
- platform: linux-ppc64
distro: bullseye
run_on_arch: ppc64le
base_image: "--platform=linux/ppc64le ppc64le/debian:bookworm"
nodejs_arch: ppc64le
nodejs_hostname: nodejs.org
nodejs_version: "18.17.0"
nodejs_version_major: 18
nodejs_version: "20.9.0"
nodejs_version_major: 20
- 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: actions/checkout@v6
- uses: uraimo/run-on-arch-action@v3
with:
arch: ${{ matrix.run_on_arch }}
distro: ${{ matrix.distro }}
arch: none
distro: none
base_image: ${{ matrix.base_image }}
env: |
prebuild_upload: "${{ startsWith(github.ref, 'refs/tags/') && secrets.GITHUB_TOKEN || '' }}"
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 --build-from-source
npx mocha --no-config --spec=test/unit/io.js --timeout=30000
npm install
npm run build
node --test test/unit/io.js
npm run package-from-local-build
npm pkg set "optionalDependencies.@img/sharp-${{ matrix.platform }}=file:./npm/${{ matrix.platform }}"
npm run clean
npm install --ignore-scripts
npx mocha --no-config --spec=test/unit/io.js --timeout=30000
[[ -n $prebuild_upload ]] && cd src && ln -s ../package.json && npx prebuild || true
github-runner-emscripten:
- uses: actions/upload-artifact@v6
with:
name: ${{ matrix.platform }}
path: npm/${{ matrix.platform }}
retention-days: 1
if-no-files-found: error
build-freebsd:
permissions:
contents: write
name: wasm32 - prebuild
contents: read
needs: lint
name: "build-freebsd"
runs-on: ubuntu-24.04
container: "emscripten/emsdk:4.0.6"
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: vmactions/freebsd-vm@v1
continue-on-error: true
with:
prepare: |
pkg update -f
pkg upgrade -y
pkg install -y devel/git devel/pkgconf graphics/vips www/node22 www/npm
pkg-config --modversion vips-cpp
run: |
npm install
npm run build
node --test test/unit/io.js
build-emscripten:
permissions:
contents: read
needs: lint
name: "build-wasm32 [package]"
runs-on: ubuntu-24.04
container: "emscripten/emsdk:4.0.21"
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@v4
uses: actions/setup-node@v5
with:
node-version: "20"
- name: Install
run: emmake npm install --build-from-source
- 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")
@@ -238,19 +332,48 @@ jobs:
echo "libvips built with emscripten $EMSCRIPTEN_VERSION_LIBVIPS"
echo "sharp built with emscripten $EMSCRIPTEN_VERSION_SHARP"
test "$EMSCRIPTEN_VERSION_LIBVIPS" = "$EMSCRIPTEN_VERSION_SHARP"
- name: Test
run: emmake npm test
- name: Test packaging
run: |
emmake npm run package-from-local-build
npm pkg set "optionalDependencies.@img/sharp-wasm32=file:./npm/wasm32"
npm run clean
rm -rf node_modules/@img/sharp-linux-x64
npm install --cpu=wasm32
npm test
- name: Prebuild
if: startsWith(github.ref, 'refs/tags/')
env:
npm_config_nodedir: emscripten
prebuild_upload: ${{ secrets.GITHUB_TOKEN }}
run: cd src && ln -s ../package.json && emmake npx prebuild --platform=emscripten --arch=wasm32 --strip=0
- run: emmake npm run test-unit
- run: emmake npm run package-from-local-build
- uses: actions/upload-artifact@v6
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@v7
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@v6
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:
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' }}

View File

@@ -43,60 +43,60 @@ jobs:
runtime: bun
- name: darwin-x64-node-npm
runs-on: macos-13
runs-on: macos-15-intel
runtime: node
package-manager: npm
- name: darwin-x64-node-pnpm
runs-on: macos-13
runs-on: macos-15-intel
runtime: node
package-manager: pnpm
- name: darwin-x64-node-yarn
runs-on: macos-13
runs-on: macos-15-intel
runtime: node
package-manager: yarn
- name: darwin-x64-node-yarn-pnp
runs-on: macos-13
runs-on: macos-15-intel
runtime: node
package-manager: yarn-pnp
- name: darwin-x64-node-yarn-v1
runs-on: macos-13
runs-on: macos-15-intel
runtime: node
package-manager: yarn-v1
- name: darwin-x64-deno
runs-on: macos-13
runs-on: macos-15-intel
runtime: deno
- name: darwin-x64-bun
runs-on: macos-13
runs-on: macos-15-intel
runtime: bun
- name: win32-x64-node-npm
runs-on: windows-2019
runs-on: windows-2022
runtime: node
package-manager: npm
- name: win32-x64-node-pnpm
runs-on: windows-2019
runs-on: windows-2022
runtime: node
package-manager: pnpm
- name: win32-x64-node-yarn
runs-on: windows-2019
runs-on: windows-2022
runtime: node
package-manager: yarn
- name: win32-x64-node-yarn-pnp
runs-on: windows-2019
runs-on: windows-2022
runtime: node
package-manager: yarn-pnp
- name: win32-x64-node-yarn-v1
runs-on: windows-2019
runs-on: windows-2022
runtime: node
package-manager: yarn-v1
- name: win32-x64-deno
runs-on: windows-2019
runs-on: windows-2022
runtime: deno
steps:
- name: Install Node.js
if: ${{ matrix.runtime == 'node' }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 20
- name: Install pnpm
@@ -106,9 +106,9 @@ jobs:
version: 8
- name: Install Deno
if: ${{ matrix.runtime == 'deno' }}
uses: denoland/setup-deno@v1
uses: denoland/setup-deno@v2
with:
deno-version: v1.x
deno-version: v2.x
- name: Install Bun
if: ${{ matrix.runtime == 'bun' }}
uses: oven-sh/setup-bun@v2
@@ -117,7 +117,7 @@ jobs:
- name: Version
id: version
uses: actions/github-script@v7
uses: actions/github-script@v8
with:
script: |
core.setOutput('semver', context.ref.replace('refs/tags/v',''))
@@ -185,7 +185,9 @@ jobs:
- name: Run with Deno
if: ${{ matrix.runtime == 'deno' }}
run: deno run --allow-read --allow-ffi release.mjs
run: |
deno install
deno run --allow-env --allow-ffi --allow-read --allow-sys release.mjs
- name: Run with Bun
if: ${{ matrix.runtime == 'bun' }}

3
.gitignore vendored
View File

@@ -1,7 +1,6 @@
src/build
src/node_modules
node_modules
/coverage
npm/*/*
!npm/*/package.json
test/bench/node_modules
@@ -9,10 +8,10 @@ test/fixtures/output*
test/fixtures/vips-properties.xml
test/leak/libvips.supp
.DS_Store
.nyc_output
.vscode/
package-lock.json
.idea
.firebase
.astro
docs/dist
release-notes.md

View File

@@ -1,7 +0,0 @@
{
"parallel": true,
"slow": 1000,
"timeout": 30000,
"require": "./test/beforeEach.js",
"spec": "./test/unit/*.js"
}

View File

@@ -1,6 +0,0 @@
{
"runtime": "napi",
"include-regex": "(sharp-.+\\.node|libvips-.+\\.dll)",
"prerelease": true,
"strip": true
}

View File

@@ -8,7 +8,7 @@ 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.
Node.js (>= 20.9.0), Deno and Bun.
Resizing an image is typically 4x-5x faster than using the
quickest ImageMagick and GraphicsMagick settings

26
biome.json Normal file
View File

@@ -0,0 +1,26 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.10/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"enabled": false,
"useEditorconfig": true
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
}

View File

@@ -1,6 +1,9 @@
// @ts-check
import { defineConfig } from 'astro/config';
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',
@@ -68,12 +71,20 @@ export default defineConfig({
]
},
{ label: 'Performance', slug: 'performance' },
{ label: 'Changelog', slug: 'changelog' }
{
label: 'Changelog',
collapsed: true,
autogenerate: { directory: 'changelog' }
}
],
social: {
openCollective: 'https://opencollective.com/libvips',
github: 'https://github.com/lovell/sharp'
}
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}`
}
});

View File

@@ -1,7 +1,7 @@
// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
'use strict';
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
import fs from 'node:fs/promises';
import path from 'node:path';

View File

@@ -11,7 +11,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.32.3",
"astro": "^5.5.3"
"@astrojs/starlight": "^0.37.1",
"astro": "^5.16.6",
"jsdoc-to-markdown": "^9.1.3",
"starlight-auto-sidebar": "^0.1.4"
}
}

View File

@@ -320,3 +320,12 @@ 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
Name: Dmytro Tiapukhin
GitHub: https://github.com/eddienubes

View File

@@ -1,7 +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() })
};

View File

@@ -8,7 +8,7 @@ title: Channel manipulation
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).
See also [flatten](/api-operation/#flatten).
**Example**
@@ -61,6 +61,8 @@ const rgba = await sharp(rgb)
Extract a single channel from a multi-channel image.
The output colourspace will be either `b-w` (8-bit) or `grey16` (16-bit).
**Throws**:

View File

@@ -80,7 +80,7 @@ as defined by [toColourspace](#tocolourspace).
| Param | Type | Description |
| --- | --- | --- |
| [colourspace] | <code>string</code> | pipeline colourspace e.g. `rgb16`, `scrgb`, `lab`, `grey16` [...](https://github.com/libvips/libvips/blob/41cff4e9d0838498487a00623462204eb10ee5b8/libvips/iofuncs/enumtypes.c#L774) |
| [colourspace] | <code>string</code> | pipeline colourspace e.g. `rgb16`, `scrgb`, `lab`, `grey16` [...](https://www.libvips.org/API/current/enum.Interpretation.html) |
**Example**
```js
@@ -123,7 +123,7 @@ By default output image will be web-friendly sRGB, with additional channels inte
| Param | Type | Description |
| --- | --- | --- |
| [colourspace] | <code>string</code> | output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://github.com/libvips/libvips/blob/3c0bfdf74ce1dc37a6429bed47fa76f16e2cd70a/libvips/iofuncs/enumtypes.c#L777-L794) |
| [colourspace] | <code>string</code> | output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://www.libvips.org/API/current/enum.Interpretation.html) |
**Example**
```js

View File

@@ -21,7 +21,7 @@ The `blend` option can be one of `clear`, `source`, `over`, `in`, `out`, `atop`,
`hard-light`, `soft-light`, `difference`, `exclusion`.
More information about blend modes can be found at
https://www.libvips.org/API/current/libvips-conversion.html#VipsBlendMode
https://www.libvips.org/API/current/enum.BlendMode.html
and https://www.cairographics.org/operators/
@@ -64,8 +64,8 @@ and https://www.cairographics.org/operators/
| [images[].raw.height] | <code>Number</code> | | |
| [images[].raw.channels] | <code>Number</code> | | |
| [images[].animated] | <code>boolean</code> | <code>false</code> | Set to `true` to read all frames/pages of an animated image. |
| [images[].failOn] | <code>string</code> | <code>&quot;&#x27;warning&#x27;&quot;</code> | @see [constructor parameters](/api-constructor#parameters) |
| [images[].limitInputPixels] | <code>number</code> \| <code>boolean</code> | <code>268402689</code> | @see [constructor parameters](/api-constructor#parameters) |
| [images[].failOn] | <code>string</code> | <code>&quot;&#x27;warning&#x27;&quot;</code> | @see [constructor parameters](/api-constructor/) |
| [images[].limitInputPixels] | <code>number</code> \| <code>boolean</code> | <code>268402689</code> | @see [constructor parameters](/api-constructor/) |
**Example**
```js

View File

@@ -44,24 +44,23 @@ where the overall height is the `pageHeight` multiplied by the number of `pages`
| [options.ignoreIcc] | <code>number</code> | <code>false</code> | should the embedded ICC profile, if any, be ignored. |
| [options.pages] | <code>number</code> | <code>1</code> | Number of pages to extract for multi-page input (GIF, WebP, TIFF), use -1 for all pages. |
| [options.page] | <code>number</code> | <code>0</code> | Page number to start extracting from for multi-page input (GIF, WebP, TIFF), zero based. |
| [options.subifd] | <code>number</code> | <code>-1</code> | subIFD (Sub Image File Directory) to extract for OME-TIFF, defaults to main image. |
| [options.level] | <code>number</code> | <code>0</code> | level to extract from a multi-level input (OpenSlide), zero based. |
| [options.pdfBackground] | <code>string</code> \| <code>Object</code> | | 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. Requires the use of a globally-installed libvips compiled with support for PDFium, Poppler, ImageMagick or GraphicsMagick. |
| [options.animated] | <code>boolean</code> | <code>false</code> | Set to `true` to read all frames/pages of an animated image (GIF, WebP, TIFF), equivalent of setting `pages` to `-1`. |
| [options.raw] | <code>Object</code> | | describes raw pixel input image data. See `raw()` for pixel ordering. |
| [options.raw.width] | <code>number</code> | | integral number of pixels wide. |
| [options.raw.height] | <code>number</code> | | integral number of pixels high. |
| [options.raw.channels] | <code>number</code> | | integral number of channels, between 1 and 4. |
| [options.raw.premultiplied] | <code>boolean</code> | | specifies that the raw input has already been premultiplied, set to `true` to avoid sharp premultiplying the image. (optional, default `false`) |
| [options.raw.pageHeight] | <code>number</code> | | The pixel height of each page/frame for animated images, must be an integral factor of `raw.height`. |
| [options.create] | <code>Object</code> | | describes a new image to be created. |
| [options.create.width] | <code>number</code> | | integral number of pixels wide. |
| [options.create.height] | <code>number</code> | | integral number of pixels high. |
| [options.create.channels] | <code>number</code> | | integral number of channels, either 3 (RGB) or 4 (RGBA). |
| [options.create.background] | <code>string</code> \| <code>Object</code> | | parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
| [options.create.pageHeight] | <code>number</code> | | The pixel height of each page/frame for animated images, must be an integral factor of `create.height`. |
| [options.create.noise] | <code>Object</code> | | describes a noise to be created. |
| [options.create.noise.type] | <code>string</code> | | type of generated noise, currently only `gaussian` is supported. |
| [options.create.noise.mean] | <code>number</code> | | mean of pixels in generated noise. |
| [options.create.noise.sigma] | <code>number</code> | | standard deviation of pixels in generated noise. |
| [options.create.noise.mean] | <code>number</code> | <code>128</code> | Mean value of pixels in the generated noise. |
| [options.create.noise.sigma] | <code>number</code> | <code>30</code> | Standard deviation of pixel values in the generated noise. |
| [options.text] | <code>Object</code> | | describes a new text image to be created. |
| [options.text.text] | <code>string</code> | | text to render as a UTF-8 string. It can contain Pango markup, for example `<i>Le</i>Monde`. |
| [options.text.font] | <code>string</code> | | font name to render with. |
@@ -81,6 +80,17 @@ where the overall height is the `pageHeight` multiplied by the number of `pages`
| [options.join.background] | <code>string</code> \| <code>Object</code> | | parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
| [options.join.halign] | <code>string</code> | <code>&quot;&#x27;left&#x27;&quot;</code> | horizontal alignment style for images joined horizontally (`'left'`, `'centre'`, `'center'`, `'right'`). |
| [options.join.valign] | <code>string</code> | <code>&quot;&#x27;top&#x27;&quot;</code> | vertical alignment style for images joined vertically (`'top'`, `'centre'`, `'center'`, `'bottom'`). |
| [options.tiff] | <code>Object</code> | | Describes TIFF specific options. |
| [options.tiff.subifd] | <code>number</code> | <code>-1</code> | Sub Image File Directory to extract for OME-TIFF, defaults to main image. |
| [options.svg] | <code>Object</code> | | Describes SVG specific options. |
| [options.svg.stylesheet] | <code>string</code> | | Custom CSS for SVG input, applied with a User Origin during the CSS cascade. |
| [options.svg.highBitdepth] | <code>boolean</code> | <code>false</code> | 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] | <code>Object</code> | | Describes PDF specific options. Requires the use of a globally-installed libvips compiled with support for PDFium, Poppler, ImageMagick or GraphicsMagick. |
| [options.pdf.background] | <code>string</code> \| <code>Object</code> | | 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] | <code>Object</code> | | Describes OpenSlide specific options. Requires the use of a globally-installed libvips compiled with support for OpenSlide. |
| [options.openSlide.level] | <code>number</code> | <code>0</code> | Level to extract from a multi-level input, zero based. |
| [options.jp2] | <code>Object</code> | | Describes JPEG 2000 specific options. Requires the use of a globally-installed libvips compiled with support for OpenJPEG. |
| [options.jp2.oneshot] | <code>boolean</code> | <code>false</code> | Set to `true` to decode tiled JPEG 2000 images in a single operation, improving compatibility. |
**Example**
```js

View File

@@ -13,17 +13,17 @@ It does not take into consideration any operations to be applied to the output i
such as resize or rotate.
Dimensions in the response will respect the `page` and `pages` properties of the
[constructor parameters](/api-constructor#parameters).
[constructor parameters](/api-constructor/).
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, 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/VipsImage.html#VipsInterpretation)
- `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/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
@@ -46,9 +46,11 @@ A `Promise` is returned when `callback` is not provided.
- `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.
- `gainMap.image`: HDR gain map, if present, as compressed JPEG image.

View File

@@ -170,7 +170,7 @@ inputStream
## sharpen
> sharpen([options], [flat], [jagged]) ⇒ <code>Sharp</code>
> sharpen([options]) ⇒ <code>Sharp</code>
Sharpen the image.
@@ -179,7 +179,7 @@ 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/libvips-convolution.html#vips-sharpen) operation.
See [libvips sharpen](https://www.libvips.org/API/current/method.Image.sharpen.html) operation.
**Throws**:
@@ -189,15 +189,13 @@ See [libvips sharpen](https://www.libvips.org/API/current/libvips-convolution.ht
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | <code>Object</code> \| <code>number</code> | | if present, is an Object with attributes |
| [options] | <code>Object</code> | | if present, is an Object with attributes |
| [options.sigma] | <code>number</code> | | the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`, between 0.000001 and 10 |
| [options.m1] | <code>number</code> | <code>1.0</code> | the level of sharpening to apply to "flat" areas, between 0 and 1000000 |
| [options.m2] | <code>number</code> | <code>2.0</code> | the level of sharpening to apply to "jagged" areas, between 0 and 1000000 |
| [options.x1] | <code>number</code> | <code>2.0</code> | threshold between "flat" and "jagged", between 0 and 1000000 |
| [options.y2] | <code>number</code> | <code>10.0</code> | maximum amount of brightening, between 0 and 1000000 |
| [options.y3] | <code>number</code> | <code>20.0</code> | maximum amount of darkening, between 0 and 1000000 |
| [flat] | <code>number</code> | | (deprecated) see `options.m1`. |
| [jagged] | <code>number</code> | | (deprecated) see `options.m2`. |
**Example**
```js
@@ -360,8 +358,6 @@ 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**

View File

@@ -117,6 +117,38 @@ await sharp(pixelArray, { raw: { width, height, channels } })
```
## toUint8Array
> toUint8Array() ⇒ <code>Promise.&lt;{data: Uint8Array, info: Object}&gt;</code>
Write output to a `Uint8Array` backed by a transferable `ArrayBuffer`.
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 [keepExif](#keepexif) and similar methods for control over this.
Resolves with an `Object` containing:
- `data` is the output image as a `Uint8Array` backed by a transferable `ArrayBuffer`.
- `info` contains properties relating to the output image such as `width` and `height`.
**Since**: v0.35.0
**Example**
```js
const { data, info } = await sharp(input).toUint8Array();
```
**Example**
```js
const { data } = await sharp(input)
.avif()
.toUint8Array();
const base64String = data.toBase64();
```
## keepExif
> keepExif() ⇒ <code>Sharp</code>
@@ -201,7 +233,7 @@ const dataWithMergedExif = await sharp(inputWithExif)
Keep ICC profile from the input image in the output image.
Where necessary, will attempt to convert the output colour space to match the profile.
When input and output colour spaces differ, use with [toColourspace](/api-colour/#tocolourspace) and optionally [pipelineColourspace](/api-colour/#pipelinecolourspace).
**Since**: 0.33.0
@@ -211,6 +243,14 @@ const outputWithIccProfile = await sharp(inputWithIccProfile)
.keepIccProfile()
.toBuffer();
```
**Example**
```js
const cmykOutputWithIccProfile = await sharp(cmykInputWithIccProfile)
.pipelineColourspace('cmyk')
.toColourspace('cmyk')
.keepIccProfile()
.toBuffer();
```
## withIccProfile
@@ -242,6 +282,78 @@ const outputWithP3 = await sharp(input)
```
## withGainMap
> withGainMap() ⇒ <code>Sharp</code>
If the input contains gain map metadata, use it to convert the main image to HDR (High Dynamic Range) before further processing.
The input gain map is discarded.
If the output is JPEG, generate and attach a new ISO 21496-1 gain map.
JPEG output options other than `quality` are ignored.
This feature is experimental and the API may change.
**Since**: 0.35.0
**Example**
```js
const outputWithGainMap = await sharp(inputWithGainMap)
.withGainMap()
.toBuffer();
```
## keepXmp
> keepXmp() ⇒ <code>Sharp</code>
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) ⇒ <code>Sharp</code>
Set XMP metadata in the output image.
Supported by PNG, JPEG, WebP, and TIFF output.
**Throws**:
- <code>Error</code> Invalid parameters
**Since**: 0.34.3
| Param | Type | Description |
| --- | --- | --- |
| xmp | <code>string</code> | String containing XMP metadata to be embedded in the output image. |
**Example**
```js
const xmpString = `
<?xml version="1.0"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:creator><rdf:Seq><rdf:li>John Doe</rdf:li></rdf:Seq></dc:creator>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>`;
const data = await sharp(input)
.withXmp(xmpString)
.toBuffer();
```
## keepMetadata
> keepMetadata() ⇒ <code>Sharp</code>
@@ -379,7 +491,7 @@ 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).
[toColourspace](/api-colour/#tocolourspace).
**Throws**:
@@ -451,6 +563,7 @@ Use these WebP options for output image.
| [options.delay] | <code>number</code> \| <code>Array.&lt;number&gt;</code> | | delay(s) between animation frames (in milliseconds) |
| [options.minSize] | <code>boolean</code> | <code>false</code> | prevent use of animation key frames to minimise file size (slow) |
| [options.mixed] | <code>boolean</code> | <code>false</code> | allow mixture of lossy and lossless animation frames (slow) |
| [options.exact] | <code>boolean</code> | <code>false</code> | preserve the colour data in transparent pixels |
| [options.force] | <code>boolean</code> | <code>true</code> | force WebP output, otherwise attempt to use input format |
**Example**
@@ -496,6 +609,7 @@ The palette of the input image will be re-used if possible.
| [options.dither] | <code>number</code> | <code>1.0</code> | level of Floyd-Steinberg error diffusion, between 0 (least) and 1 (most) |
| [options.interFrameMaxError] | <code>number</code> | <code>0</code> | maximum inter-frame error for transparency, between 0 (lossless) and 32 |
| [options.interPaletteMaxError] | <code>number</code> | <code>3</code> | maximum inter-palette error for palette reuse, between 0 and 256 |
| [options.keepDuplicateFrames] | <code>boolean</code> | <code>false</code> | keep duplicate frames in the output instead of combining them |
| [options.loop] | <code>number</code> | <code>0</code> | number of animation iterations, use 0 for infinite animation |
| [options.delay] | <code>number</code> \| <code>Array.&lt;number&gt;</code> | | delay(s) between animation frames (in milliseconds) |
| [options.force] | <code>boolean</code> | <code>true</code> | force GIF output, otherwise attempt to use input format |
@@ -537,7 +651,7 @@ 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](https://sharp.pixelplumbing.com/install#custom-libvips).
[installing a custom libvips](/install#custom-libvips).
**Throws**:
@@ -594,6 +708,7 @@ instead of providing `xres` and `yres` in pixels/mm.
| [options.quality] | <code>number</code> | <code>80</code> | quality, integer 1-100 |
| [options.force] | <code>boolean</code> | <code>true</code> | force TIFF output, otherwise attempt to use input format |
| [options.compression] | <code>string</code> | <code>&quot;&#x27;jpeg&#x27;&quot;</code> | compression options: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k |
| [options.bigtiff] | <code>boolean</code> | <code>false</code> | use BigTIFF variant (has no effect when compression is none) |
| [options.predictor] | <code>string</code> | <code>&quot;&#x27;horizontal&#x27;&quot;</code> | compression predictor options: none, horizontal, float |
| [options.pyramid] | <code>boolean</code> | <code>false</code> | write an image pyramid |
| [options.tile] | <code>boolean</code> | <code>false</code> | write a tiled tiff |
@@ -602,7 +717,7 @@ instead of providing `xres` and `yres` in pixels/mm.
| [options.xres] | <code>number</code> | <code>1.0</code> | horizontal resolution in pixels/mm |
| [options.yres] | <code>number</code> | <code>1.0</code> | vertical resolution in pixels/mm |
| [options.resolutionUnit] | <code>string</code> | <code>&quot;&#x27;inch&#x27;&quot;</code> | resolution unit options: inch, cm |
| [options.bitdepth] | <code>number</code> | <code>8</code> | reduce bitdepth to 1, 2 or 4 bit |
| [options.bitdepth] | <code>number</code> | <code>0</code> | reduce bitdepth to 1, 2 or 4 bit |
| [options.miniswhite] | <code>boolean</code> | <code>false</code> | write 1-bit images as miniswhite |
**Example**
@@ -626,6 +741,8 @@ Use these AVIF options for output image.
AVIF image sequences are not supported.
Prebuilt binaries support a bitdepth of 8 only.
When using Windows ARM64, this feature requires a CPU with ARM64v8.4 or later.
**Throws**:
@@ -641,6 +758,7 @@ Prebuilt binaries support a bitdepth of 8 only.
| [options.effort] | <code>number</code> | <code>4</code> | CPU effort, between 0 (fastest) and 9 (slowest) |
| [options.chromaSubsampling] | <code>string</code> | <code>&quot;&#x27;4:4:4&#x27;&quot;</code> | set to '4:2:0' to use chroma subsampling |
| [options.bitdepth] | <code>number</code> | <code>8</code> | set bitdepth to 8, 10 or 12 bit |
| [options.tune] | <code>string</code> | <code>&quot;&#x27;iq&#x27;&quot;</code> | tune output for a quality metric, one of 'iq' (default), 'ssim' (default when lossless) or 'psnr' |
**Example**
```js
@@ -680,6 +798,7 @@ globally-installed libvips compiled with support for libheif, libde265 and x265.
| [options.effort] | <code>number</code> | <code>4</code> | CPU effort, between 0 (fastest) and 9 (slowest) |
| [options.chromaSubsampling] | <code>string</code> | <code>&quot;&#x27;4:4:4&#x27;&quot;</code> | set to '4:2:0' to use chroma subsampling |
| [options.bitdepth] | <code>number</code> | <code>8</code> | set bitdepth to 8, 10 or 12 bit |
| [options.tune] | <code>string</code> | <code>&quot;&#x27;ssim&#x27;&quot;</code> | tune output for a quality metric, one of 'ssim' (default), 'psnr' or 'iq' |
**Example**
```js
@@ -698,7 +817,7 @@ 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](https://sharp.pixelplumbing.com/install#custom-libvips).
[installing a custom libvips](/install/#custom-libvips).
**Throws**:

View File

@@ -38,6 +38,8 @@ Possible downsizing kernels are:
- `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`.
@@ -282,6 +284,7 @@ The `info` response Object will contain `trimOffsetLeft` and `trimOffsetTop` pro
| [options.background] | <code>string</code> \| <code>Object</code> | <code>&quot;&#x27;top-left pixel&#x27;&quot;</code> | Background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to that of the top-left pixel. |
| [options.threshold] | <code>number</code> | <code>10</code> | Allowed difference from the above colour, a positive number. |
| [options.lineArt] | <code>boolean</code> | <code>false</code> | Does the input more closely resemble line art (e.g. vector) rather than being photographic? |
| [options.margin] | <code>number</code> | <code>0</code> | Leave a margin around trimmed content, value is in pixels. |
**Example**
```js
@@ -318,4 +321,13 @@ const output = await sharp(input)
threshold: 42,
})
.toBuffer();
```
**Example**
```js
// Trim image leaving (up to) a 10 pixel margin around the trimmed content.
const output = await sharp(input)
.trim({
margin: 10
})
.toBuffer();
```

View File

@@ -113,15 +113,9 @@ 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.
The maximum number of images that sharp can process in parallel
is controlled by libuv's `UV_THREADPOOL_SIZE` environment variable,
which defaults to 4.
https://nodejs.org/api/cli.html#uv_threadpool_sizesize
For example, by default, a machine with 8 CPU cores will process
4 images in parallel and use up to 8 threads per image,
so there will be up to 32 concurrent threads.
:::note
Further [control over performance](/performance/) is available.
:::
**Returns**: <code>number</code> - concurrency

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
sort: reverse-slug

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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.

View File

@@ -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)

View File

@@ -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.

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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.

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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.

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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.

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

Some files were not shown because too many files have changed in this diff Show More