Compare commits
340 Commits
v0.33.0-al
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
ecfc77c185 | ||
|
6cde18d443 | ||
|
276ac2df8d | ||
|
2dedcf35a0 | ||
|
92f21451c1 | ||
|
2cd2f8430a | ||
|
8ee8d273ee | ||
|
4e3f3792ad | ||
|
df5454e7dc | ||
|
32cf6be1b8 | ||
|
96dfd400b2 | ||
|
1422798c1d | ||
|
e26d4e9d5b | ||
|
852c7f8663 | ||
|
e286e2bff9 | ||
|
76995deefa | ||
|
e688c53659 | ||
|
c4b1d80c35 | ||
|
f92540f134 | ||
|
8c53d499f7 | ||
|
9392b8702b | ||
|
8669fbc936 | ||
|
cab02463ec | ||
|
5374b036f3 | ||
|
327a6d2083 | ||
|
751f9992c4 | ||
|
01f6cbbaee | ||
|
99be893dd4 | ||
|
4d1f7e051d | ||
|
91f1b58f31 | ||
|
6d04b7c1fa | ||
|
d4b30b7392 | ||
|
7f03502003 | ||
|
63b0a11b5b | ||
|
c4d6aec48c | ||
|
e75ae970ed | ||
|
956d72ddc0 | ||
|
00e66efbee | ||
|
db3a4528eb | ||
|
d36fd5064d | ||
|
8e17c6f518 | ||
|
94481a967e | ||
|
32872ef840 | ||
|
7c7f960b60 | ||
|
0b5f131df8 | ||
|
e922ef7450 | ||
|
73bec629cf | ||
|
758d7e63cc | ||
|
eba3e9aeb2 | ||
|
701143afb3 | ||
|
38b6f44611 | ||
|
5b5dfbad77 | ||
|
a642767329 | ||
|
5cae1abe8f | ||
|
66ffc48707 | ||
|
3c7dbb8fba | ||
|
a9e191328f | ||
|
7323dbee98 | ||
|
d7a771ca7a | ||
|
7d0585fad1 | ||
|
ddc1eb8c4c | ||
|
c26e67cc5b | ||
|
a00ee26d17 | ||
|
6dfb60cda2 | ||
|
dbb7606129 | ||
|
031c808aa5 | ||
|
03e1b19764 | ||
|
3e41f8b65e | ||
|
3fd818c4b5 | ||
|
d419aba76d | ||
|
3fb1091114 | ||
|
2035492fd9 | ||
|
5ee83d13e2 | ||
|
0d04e9dba3 | ||
|
f3a4f060c6 | ||
|
3c177af594 | ||
|
9d40a64120 | ||
|
fda06a62b0 | ||
|
75a135eabe | ||
|
c9850afe67 | ||
|
a619f29313 | ||
|
9b88547f12 | ||
|
8e3ec0fc61 | ||
|
edad89c531 | ||
|
9d01dd20bf | ||
|
5ab9168813 | ||
|
67ff930535 | ||
|
ae5ba702a4 | ||
|
63f0ab5e20 | ||
|
eeac8d4656 | ||
|
14c83e1f4c | ||
|
b7ff2645c4 | ||
|
79ac524262 | ||
|
92083ea64c | ||
|
82dc859a49 | ||
|
bee1fbaa34 | ||
|
eba82a8ba5 | ||
|
06b08bf10f | ||
|
7bdf419eb1 | ||
|
04e7f58cea | ||
|
3796dd8a87 | ||
|
8afec170ed | ||
|
3154af776e | ||
|
6480a94181 | ||
|
9582b5036f | ||
|
1533bf995a | ||
|
a53d7cb6bf | ||
|
b249357732 | ||
|
807d9241bd | ||
|
9bfaca2857 | ||
|
c26b77683a | ||
|
7ee54810d4 | ||
|
fc32e0bd3f | ||
|
0546e48467 | ||
|
ab65b7a0f1 | ||
|
2474bd4163 | ||
|
ff2e689d35 | ||
|
6327f13717 | ||
|
f1e69a218e | ||
|
3c14dbb21e | ||
|
82cebc31d0 | ||
|
ad36fa0605 | ||
|
de42667767 | ||
|
2eb03b0049 | ||
|
f7ed9b7fb6 | ||
|
7fbb988180 | ||
|
490210fc60 | ||
|
735fee74db | ||
|
67a5854b89 | ||
|
f128ebdbd4 | ||
|
2672de2480 | ||
|
67a4592756 | ||
|
10c6f474d9 | ||
|
d642108be2 | ||
|
c2a024101b | ||
|
2f0bbebfc9 | ||
|
60c5c5083d | ||
|
eab7dc1b49 | ||
|
5c7f37a0e0 | ||
|
ae06f46914 | ||
|
9c05ea8dd2 | ||
|
472aaf3311 | ||
|
56fae3eda1 | ||
|
cc96c21e42 | ||
|
1d344888ec | ||
|
bee235ee76 | ||
|
19d0e272e6 | ||
|
16b764f1c1 | ||
|
1593ee3838 | ||
|
668b5ba8bc | ||
|
29336f4cc7 | ||
|
b5fddd7c5e | ||
|
da655a1859 | ||
|
93c615d39f | ||
|
f325dc3ec9 | ||
|
0fde71c783 | ||
|
9c8fbaa1cc | ||
|
a9e662e612 | ||
|
ba843002be | ||
|
7f3d452bc5 | ||
|
aa8bc19362 | ||
|
36e60bf040 | ||
|
a1309aa3b8 | ||
|
3e8a0fc522 | ||
|
397ee492d9 | ||
|
52b9dc0f63 | ||
|
a715c73fc2 | ||
|
579cf93030 | ||
|
f67228e5ea | ||
|
6257994746 | ||
|
7950fc0ea3 | ||
|
fc93ab3b82 | ||
|
0981b24f60 | ||
|
02fd565476 | ||
|
e55bb93b10 | ||
|
55466f122c | ||
|
ede8217ab3 | ||
|
2689fb4e65 | ||
|
eaf31a59e5 | ||
|
aa1bbcb5c1 | ||
|
3c26080c39 | ||
|
dc07fd4e9c | ||
|
7bc74feb11 | ||
|
c5f318ed4d | ||
|
8fbb1cd154 | ||
|
88aee8a887 | ||
|
0f77b18078 | ||
|
3eeaee71c0 | ||
|
045d54e2e6 | ||
|
75fedf1b75 | ||
|
debdacb726 | ||
|
1c8ae67ed2 | ||
|
0eb57698ec | ||
|
bc95531f2d | ||
|
60f4048d6c | ||
|
fb70fbb09f | ||
|
fc439bedf1 | ||
|
26d0b7147d | ||
|
af6aa8a690 | ||
|
bd4f1abba2 | ||
|
d2656a3679 | ||
|
a3b45ceccc | ||
|
0dcc7d50a8 | ||
|
bcb22af034 | ||
|
d04dc62666 | ||
|
c30d355f97 | ||
|
49cb148b38 | ||
|
3bc31a8b20 | ||
|
c28523e70e | ||
|
278f393f74 | ||
|
cbf68c1395 | ||
|
45e8071599 | ||
|
b96389d975 | ||
|
a77ac6ae25 | ||
|
9bcf399b4c | ||
|
4aacee8055 | ||
|
0b18aeff62 | ||
|
bed1c2ac18 | ||
|
8cd832656b | ||
|
0499f59e71 | ||
|
1fa59bf9b3 | ||
|
db40ee6912 | ||
|
02b98b8e1b | ||
|
31fef216e4 | ||
|
77ab5d7a51 | ||
|
cd5cf7ce2d | ||
|
39cb9d9a6c | ||
|
4919bc5134 | ||
|
a4e64eb01f | ||
|
328b18df88 | ||
|
5e7bf32e5e | ||
|
04403f4e5f | ||
|
420e0822b4 | ||
|
f7a3ea6415 | ||
|
f28e79ef4f | ||
|
5cd787bf85 | ||
|
021d637fd6 | ||
|
2e14096af7 | ||
|
fe2b298a2f | ||
|
c9e3996007 | ||
|
3a0c375692 | ||
|
c5eaeb2ddb | ||
|
19fa4cd1d3 | ||
|
0adf7ef16f | ||
|
8f7fb96a44 | ||
|
9e3b021b1a | ||
|
25164d4cef | ||
|
516b1ec332 | ||
|
95ba045a69 | ||
|
6e02f9288e | ||
|
a584ae093e | ||
|
1592f96b7b | ||
|
004fff975f | ||
|
4d049ee8f5 | ||
|
c80e92fa16 | ||
|
545e09fad2 | ||
|
133dc56ff4 | ||
|
9c877d93fa | ||
|
7ad86fed03 | ||
|
31cf07f0ba | ||
|
4ffb48711a | ||
|
3da96a86e6 | ||
|
45ed9ea9bf | ||
|
61057f25bc | ||
|
68ef72cb61 | ||
|
ef32dccb83 | ||
|
e78200cc84 | ||
|
3f7313d031 | ||
|
139e4b9f65 | ||
|
9680f00ddd | ||
|
0b0ebfe6f8 | ||
|
5aadb8294c | ||
|
ace1681886 | ||
|
75ef61a958 | ||
|
2dba5b5451 | ||
|
a8f68ba7f0 | ||
|
475bf16b09 | ||
|
67f49a8dcd | ||
|
074004392c | ||
|
8c5a493f68 | ||
|
cccd1635c5 | ||
|
1915c1387e | ||
|
4a37a27cca | ||
|
ab8a4ed532 | ||
|
12fd512b83 | ||
|
239435a6dc | ||
|
7c1551bdc9 | ||
|
bdcf02695f | ||
|
d206fd5392 | ||
|
0bd1715f36 | ||
|
2e7c60675b | ||
|
7caaa8e22b | ||
|
839c92bf3d | ||
|
28aa176957 | ||
|
0f24f0f214 | ||
|
655da113c8 | ||
|
159b986cdd | ||
|
069d1786f5 | ||
|
f43829a16a | ||
|
65e61ad001 | ||
|
0107a4de81 | ||
|
337ce7b1c2 | ||
|
3719f79065 | ||
|
8d1747aa6a | ||
|
de9bdcba0a | ||
|
f8b6cb6d5b | ||
|
e6942805b4 | ||
|
47e76c9981 | ||
|
68fa84ef6f | ||
|
ff2fb18c76 | ||
|
28a9b1e9fa | ||
|
6377d5a73a | ||
|
80e4707af1 | ||
|
ab00e34d0d | ||
|
7c2f883b67 | ||
|
9b5eecba8f | ||
|
4b028edfe9 | ||
|
7e25dd7be1 | ||
|
09460d7af4 | ||
|
3b22640077 | ||
|
946976ba8f | ||
|
29a83250a4 | ||
|
3f54ef7525 | ||
|
4dc2467f49 | ||
|
f54ceb0973 | ||
|
8d033ae341 | ||
|
f7da2e5970 | ||
|
51e56f994c | ||
|
68ac12292c | ||
|
a9aa7339ce | ||
|
08108f5fad | ||
|
58e3c4c70e | ||
|
f8cf25ca56 | ||
|
ca95979ecc | ||
|
392f6afb5e | ||
|
7c97aabaf8 | ||
|
fcc7e84bee | ||
|
226a9a13ef | ||
|
4d3c9ae3d1 | ||
|
f31011d759 |
@ -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-2004: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.@sharpen/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 \"npx prebuild --upload=$prebuild_upload\" || true"
|
|
||||||
linux-arm64-glibc-node-20:
|
|
||||||
resource_class: arm.medium
|
|
||||||
machine:
|
|
||||||
image: ubuntu-2004: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.@sharpen/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-2004: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.@sharpen/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 \"npx prebuild --upload=$prebuild_upload\" || true"
|
|
||||||
linux-arm64-musl-node-20:
|
|
||||||
resource_class: arm.medium
|
|
||||||
machine:
|
|
||||||
image: ubuntu-2004: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.@sharpen/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"
|
|
@ -1,5 +1,5 @@
|
|||||||
freebsd_instance:
|
freebsd_instance:
|
||||||
image_family: freebsd-13-2
|
image_family: freebsd-15-0-snap
|
||||||
|
|
||||||
task:
|
task:
|
||||||
name: FreeBSD
|
name: FreeBSD
|
||||||
@ -10,7 +10,8 @@ task:
|
|||||||
- pkg update -f
|
- pkg update -f
|
||||||
- pkg upgrade -y
|
- pkg upgrade -y
|
||||||
- pkg install -y devel/git devel/pkgconf graphics/vips www/node20 www/npm
|
- pkg install -y devel/git devel/pkgconf graphics/vips www/node20 www/npm
|
||||||
|
- pkg-config --modversion vips-cpp
|
||||||
install_script:
|
install_script:
|
||||||
- npm install --build-from-source
|
- npm install --build-from-source
|
||||||
test_script:
|
test_script:
|
||||||
- npm test
|
- npx mocha --no-config --spec=test/unit/io.js --timeout=30000
|
||||||
|
1
.gitattributes
vendored
@ -1 +0,0 @@
|
|||||||
src/libvips/* linguist-vendored
|
|
2
.github/CONTRIBUTING.md
vendored
@ -63,7 +63,7 @@ By way of example, the `background()` method present in v0.20.0 was deprecated i
|
|||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
The public API is documented with [JSDoc](http://usejsdoc.org/) annotated comments.
|
The public API is documented with [JSDoc](https://jsdoc.app/) annotated comments.
|
||||||
|
|
||||||
These can be converted to Markdown by running:
|
These can be converted to Markdown by running:
|
||||||
```sh
|
```sh
|
||||||
|
33
.github/ISSUE_TEMPLATE/installation.md
vendored
@ -11,7 +11,10 @@ labels: installation
|
|||||||
|
|
||||||
<!-- Please place an [x] in the box to confirm. -->
|
<!-- Please place an [x] in the box to confirm. -->
|
||||||
|
|
||||||
- [ ] I have read the [documentation relating to installation](https://sharp.pixelplumbing.com/install).
|
- [ ] I have read and understood all of the [documentation relating to installation](https://sharp.pixelplumbing.com/install).
|
||||||
|
- [ ] I have searched for known bugs relating to this problem in my choice of package manager.
|
||||||
|
|
||||||
|
You must confirm both of these before continuing.
|
||||||
|
|
||||||
### Are you using the latest version of sharp?
|
### Are you using the latest version of sharp?
|
||||||
|
|
||||||
@ -21,27 +24,37 @@ labels: installation
|
|||||||
|
|
||||||
If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
|
If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
|
||||||
|
|
||||||
If you are using another package which depends on a version of `sharp` that is not the latest, please open an issue against that package instead.
|
If you are using another package which depends on a version of `sharp` that is not the latest,
|
||||||
|
please open an issue against that package instead.
|
||||||
|
|
||||||
### Are you using a supported runtime?
|
### Are you using a supported runtime?
|
||||||
|
|
||||||
<!-- Please place an [x] in the relevant box to confirm. -->
|
<!-- Please place an [x] in the relevant box to confirm. -->
|
||||||
|
|
||||||
- [ ] I am using Node.js 18 with a version >= 18.17.0
|
- [ ] I am using Node.js with a version that satisfies `^18.17.0 || ^20.3.0 || >=21.0.0`
|
||||||
- [ ] I am using Node.js 20 with a version >= 20.3.0
|
- [ ] I am using Deno
|
||||||
- [ ] I am using Node.js 21 or later
|
- [ ] I am using Bun
|
||||||
|
|
||||||
If you cannot confirm any of these, please upgrade to the latest version and try again before opening an issue.
|
If you cannot confirm any of these,
|
||||||
|
please upgrade to the latest version
|
||||||
|
and try again before opening an issue.
|
||||||
|
|
||||||
### Are you using a supported package manager?
|
### Are you using a supported package manager and installing optional dependencies?
|
||||||
|
|
||||||
<!-- Please place an [x] in the relevant box to confirm. -->
|
<!-- Please place an [x] in the relevant box to confirm. -->
|
||||||
|
|
||||||
- [ ] I am using npm >= 9.6.5
|
- [ ] I am using npm >= 10.1.0 with `--include=optional`
|
||||||
- [ ] I am using yarn >= 3.2.0
|
- [ ] I am using yarn >= 3.2.0
|
||||||
- [ ] I am using pnpm >= 7.1.0
|
- [ ] I am using pnpm >= 7.1.0 with `--no-optional=false`
|
||||||
|
- [ ] I am using Deno
|
||||||
|
- [ ] I am using Bun
|
||||||
|
|
||||||
If you cannot confirm any of these, please upgrade to the latest version and try again before opening an issue.
|
If you cannot confirm any of these, please upgrade to the latest version of your chosen package manager
|
||||||
|
and ensure you are allowing the installation of optional or multi-platform dependencies before opening an issue.
|
||||||
|
|
||||||
|
### What is the complete error message, including the full stack trace?
|
||||||
|
|
||||||
|
<!-- Please provide the error message and stack trace here. -->
|
||||||
|
|
||||||
### What is the complete output of running `npm install --verbose --foreground-scripts sharp` in an empty directory?
|
### What is the complete output of running `npm install --verbose --foreground-scripts sharp` in an empty directory?
|
||||||
|
|
||||||
|
16
.github/ISSUE_TEMPLATE/possible-bug.md
vendored
@ -32,6 +32,22 @@ If you are using another package which depends on a version of `sharp` that is n
|
|||||||
|
|
||||||
<!-- Please provide output of the above command here. -->
|
<!-- Please provide output of the above command here. -->
|
||||||
|
|
||||||
|
### Does this problem relate to file caching?
|
||||||
|
|
||||||
|
The default behaviour of libvips is to cache input files, which can lead to `EBUSY` or `EPERM` errors on Windows.
|
||||||
|
Use [`sharp.cache(false)`](https://sharp.pixelplumbing.com/api-utility#cache) to switch this feature off.
|
||||||
|
|
||||||
|
- [ ] Adding `sharp.cache(false)` does not fix this problem.
|
||||||
|
|
||||||
|
### Does this problem relate to images appearing to have been rotated by 90 degrees?
|
||||||
|
|
||||||
|
Images that contain EXIF Orientation metadata are not auto-oriented. By default, EXIF metadata is removed.
|
||||||
|
|
||||||
|
- To auto-orient pixel values use the parameter-less [`rotate()`](https://sharp.pixelplumbing.com/api-operation#rotate) operation.
|
||||||
|
- To retain EXIF Orientation use [`keepExif()`](https://sharp.pixelplumbing.com/api-output#keepexif).
|
||||||
|
|
||||||
|
- [ ] Using `rotate()` or `keepExif()` does not fix this problem.
|
||||||
|
|
||||||
### What are the steps to reproduce?
|
### What are the steps to reproduce?
|
||||||
|
|
||||||
<!-- Please enter steps to reproduce here. -->
|
<!-- Please enter steps to reproduce here. -->
|
||||||
|
363
.github/workflows/ci.yml
vendored
@ -4,187 +4,328 @@ on:
|
|||||||
- pull_request
|
- pull_request
|
||||||
permissions: {}
|
permissions: {}
|
||||||
jobs:
|
jobs:
|
||||||
github-runner:
|
build-native:
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
name: ${{ matrix.platform }} - Node.js ${{ matrix.nodejs_version_major }} ${{ matrix.prebuild && '- prebuild' }}
|
name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
container: ${{ matrix.container }}
|
container: ${{ matrix.container }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-24.04
|
||||||
container: rockylinux:8
|
container: rockylinux:8
|
||||||
|
nodejs_arch: x64
|
||||||
nodejs_version: "^18.17.0"
|
nodejs_version: "^18.17.0"
|
||||||
nodejs_version_major: 18
|
nodejs_version_major: 18
|
||||||
platform: linux-x64
|
platform: linux-x64
|
||||||
prebuild: true
|
package: true
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-24.04
|
||||||
container: rockylinux:8
|
container: rockylinux:8
|
||||||
|
nodejs_arch: x64
|
||||||
nodejs_version: "^20.3.0"
|
nodejs_version: "^20.3.0"
|
||||||
nodejs_version_major: 20
|
nodejs_version_major: 20
|
||||||
platform: linux-x64
|
platform: linux-x64
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-24.04
|
||||||
|
container: rockylinux:8
|
||||||
|
nodejs_arch: x64
|
||||||
|
nodejs_version: "^22.9.0"
|
||||||
|
nodejs_version_major: 22
|
||||||
|
platform: linux-x64
|
||||||
|
- os: ubuntu-24.04
|
||||||
container: node:18-alpine3.17
|
container: node:18-alpine3.17
|
||||||
nodejs_version_major: 18
|
nodejs_version_major: 18
|
||||||
platform: linuxmusl-x64
|
platform: linuxmusl-x64
|
||||||
prebuild: true
|
package: true
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-24.04
|
||||||
container: node:20-alpine3.18
|
container: node:20-alpine3.18
|
||||||
nodejs_version_major: 20
|
nodejs_version_major: 20
|
||||||
platform: linuxmusl-x64
|
platform: linuxmusl-x64
|
||||||
- os: macos-11
|
- os: ubuntu-24.04
|
||||||
|
container: node:22-alpine3.20
|
||||||
|
nodejs_version_major: 22
|
||||||
|
platform: linuxmusl-x64
|
||||||
|
- os: ubuntu-24.04-arm
|
||||||
|
container: arm64v8/rockylinux:8
|
||||||
|
nodejs_arch: arm64
|
||||||
|
nodejs_version: "^18.17.0"
|
||||||
|
nodejs_version_major: 18
|
||||||
|
platform: linux-arm64
|
||||||
|
package: true
|
||||||
|
- os: ubuntu-24.04-arm
|
||||||
|
container: arm64v8/rockylinux:8
|
||||||
|
nodejs_arch: arm64
|
||||||
|
nodejs_version: "^20.3.0"
|
||||||
|
nodejs_version_major: 20
|
||||||
|
platform: linux-arm64
|
||||||
|
- os: macos-13
|
||||||
nodejs_arch: x64
|
nodejs_arch: x64
|
||||||
nodejs_version: "^18.17.0"
|
nodejs_version: "^18.17.0"
|
||||||
nodejs_version_major: 18
|
nodejs_version_major: 18
|
||||||
platform: darwin-x64
|
platform: darwin-x64
|
||||||
prebuild: true
|
package: true
|
||||||
- os: macos-11
|
- os: macos-13
|
||||||
nodejs_arch: x64
|
nodejs_arch: x64
|
||||||
nodejs_version: "^20.3.0"
|
nodejs_version: "^20.3.0"
|
||||||
nodejs_version_major: 20
|
nodejs_version_major: 20
|
||||||
platform: darwin-x64
|
platform: darwin-x64
|
||||||
- os: windows-2019
|
- os: macos-13
|
||||||
nodejs_arch: x86
|
nodejs_arch: x64
|
||||||
|
nodejs_version: "^22.9.0"
|
||||||
|
nodejs_version_major: 22
|
||||||
|
platform: darwin-x64
|
||||||
|
- os: macos-14
|
||||||
|
nodejs_arch: arm64
|
||||||
nodejs_version: "^18.17.0"
|
nodejs_version: "^18.17.0"
|
||||||
nodejs_version_major: 18
|
nodejs_version_major: 18
|
||||||
|
platform: darwin-arm64
|
||||||
|
package: true
|
||||||
|
- os: macos-14
|
||||||
|
nodejs_arch: arm64
|
||||||
|
nodejs_version: "^20.3.0"
|
||||||
|
nodejs_version_major: 20
|
||||||
|
platform: darwin-arm64
|
||||||
|
- os: macos-14
|
||||||
|
nodejs_arch: arm64
|
||||||
|
nodejs_version: "^22.9.0"
|
||||||
|
nodejs_version_major: 22
|
||||||
|
platform: darwin-arm64
|
||||||
|
- os: windows-2022
|
||||||
|
nodejs_arch: x86
|
||||||
|
nodejs_version: "18.18.2" # pinned to avoid 18.19.0 and npm 10
|
||||||
|
nodejs_version_major: 18
|
||||||
platform: win32-ia32
|
platform: win32-ia32
|
||||||
prebuild: true
|
package: true
|
||||||
- os: windows-2019
|
- os: windows-2022
|
||||||
nodejs_arch: x86
|
nodejs_arch: x86
|
||||||
nodejs_version: "^20.3.0"
|
nodejs_version: "^20.3.0"
|
||||||
nodejs_version_major: 20
|
nodejs_version_major: 20
|
||||||
platform: win32-ia32
|
platform: win32-ia32
|
||||||
- os: windows-2019
|
- os: windows-2022
|
||||||
|
nodejs_arch: x86
|
||||||
|
nodejs_version: "^22.9.0"
|
||||||
|
nodejs_version_major: 22
|
||||||
|
platform: win32-ia32
|
||||||
|
- os: windows-2022
|
||||||
nodejs_arch: x64
|
nodejs_arch: x64
|
||||||
nodejs_version: "^18.17.0"
|
nodejs_version: "^18.17.0"
|
||||||
nodejs_version_major: 18
|
nodejs_version_major: 18
|
||||||
platform: win32-x64
|
platform: win32-x64
|
||||||
prebuild: true
|
package: true
|
||||||
- os: windows-2019
|
- os: windows-2022
|
||||||
nodejs_arch: x64
|
nodejs_arch: x64
|
||||||
nodejs_version: "^20.3.0"
|
nodejs_version: "^20.3.0"
|
||||||
nodejs_version_major: 20
|
nodejs_version_major: 20
|
||||||
platform: win32-x64
|
platform: win32-x64
|
||||||
|
- os: windows-2022
|
||||||
|
nodejs_arch: x64
|
||||||
|
nodejs_version: "^22.9.0"
|
||||||
|
nodejs_version_major: 22
|
||||||
|
platform: win32-x64
|
||||||
|
- os: windows-11-arm
|
||||||
|
nodejs_arch: arm64
|
||||||
|
nodejs_version: "^20.3.0"
|
||||||
|
nodejs_version_major: 20
|
||||||
|
platform: win32-arm64
|
||||||
|
package: true
|
||||||
|
- os: windows-11-arm
|
||||||
|
nodejs_arch: arm64
|
||||||
|
nodejs_version: "^22.9.0"
|
||||||
|
nodejs_version_major: 22
|
||||||
|
platform: win32-arm64
|
||||||
steps:
|
steps:
|
||||||
- name: Dependencies (Linux glibc)
|
|
||||||
if: contains(matrix.container, 'centos')
|
|
||||||
run: |
|
|
||||||
yum install -y https://rpm.nodesource.com/pub_${{ matrix.nodejs_version_major }}.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm
|
|
||||||
yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
|
|
||||||
yum install -y centos-release-scl
|
|
||||||
yum install -y devtoolset-11-gcc-c++ make git python3 nodejs fontconfig google-noto-sans-fonts
|
|
||||||
echo "/opt/rh/devtoolset-11/root/usr/bin" >> $GITHUB_PATH
|
|
||||||
- name: Dependencies (Rocky Linux glibc)
|
- name: Dependencies (Rocky Linux glibc)
|
||||||
if: contains(matrix.container, 'rockylinux')
|
if: contains(matrix.container, 'rockylinux')
|
||||||
run: |
|
run: |
|
||||||
dnf install -y https://rpm.nodesource.com/pub_${{ matrix.nodejs_version_major }}.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm
|
dnf install -y gcc-toolset-14-gcc-c++ make git python3.12 fontconfig google-noto-sans-fonts
|
||||||
dnf install -y --setopt=nodesource-nodejs.module_hotfixes=1 nodejs
|
echo "/opt/rh/gcc-toolset-14/root/usr/bin" >> $GITHUB_PATH
|
||||||
dnf install -y gcc-toolset-11-gcc-c++ make git python3 fontconfig google-noto-sans-fonts
|
|
||||||
echo "/opt/rh/gcc-toolset-11/root/usr/bin" >> $GITHUB_PATH
|
|
||||||
- name: Dependencies (Linux musl)
|
- name: Dependencies (Linux musl)
|
||||||
if: contains(matrix.container, 'alpine')
|
if: contains(matrix.container, 'alpine')
|
||||||
run: apk add build-base git python3 font-noto --update-cache
|
run: apk add build-base git python3 font-noto --update-cache
|
||||||
- name: Dependencies (Python 3.11 - macOS, Windows)
|
- name: Dependencies (Python 3.11 - macOS, Windows)
|
||||||
if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows')
|
if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows')
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: "3.12"
|
||||||
- name: Dependencies (Node.js - macOS, Windows)
|
- name: Dependencies (Node.js)
|
||||||
if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows')
|
if: "!contains(matrix.platform, 'linuxmusl')"
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.nodejs_version }}
|
node-version: ${{ matrix.nodejs_version }}
|
||||||
architecture: ${{ matrix.nodejs_arch }}
|
architecture: ${{ matrix.nodejs_arch }}
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Install
|
- name: Install
|
||||||
run: npm install --build-from-source
|
run: npm install --build-from-source
|
||||||
- name: Test
|
- name: Test
|
||||||
run: npm test
|
run: npm test
|
||||||
- name: Test packaging
|
- name: Populate npm package
|
||||||
run: |
|
if: matrix.package
|
||||||
npm run package-from-local-build
|
run: npm run package-from-local-build
|
||||||
npm pkg set "optionalDependencies.@sharpen/sharp-${{ matrix.platform }}=file:./npm/${{ matrix.platform }}"
|
- uses: actions/upload-artifact@v4
|
||||||
npm run clean
|
if: matrix.package
|
||||||
npm install --ignore-scripts
|
|
||||||
npm test
|
|
||||||
- name: Prebuild
|
|
||||||
if: matrix.prebuild && startsWith(github.ref, 'refs/tags/')
|
|
||||||
env:
|
|
||||||
prebuild_upload: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: npx prebuild
|
|
||||||
github-runner-qemu:
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
name: linux-arm - Node.js 18 - prebuild
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: uraimo/run-on-arch-action@v2
|
|
||||||
with:
|
with:
|
||||||
arch: armv6
|
name: ${{ matrix.platform }}
|
||||||
distro: buster
|
path: npm/${{ matrix.platform }}
|
||||||
env: |
|
retention-days: 1
|
||||||
nodejs_version: "18.17.0"
|
if-no-files-found: error
|
||||||
prebuild_upload: "${{ startsWith(github.ref, 'refs/tags/') && secrets.GITHUB_TOKEN || '' }}"
|
build-linuxmusl-arm-64:
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y fontconfig fonts-noto-core g++ git libatomic1 make python3 xz-utils
|
|
||||||
mkdir /opt/nodejs
|
|
||||||
curl --silent https://unofficial-builds.nodejs.org/download/release/v${nodejs_version}/node-v${nodejs_version}-linux-armv6l.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
|
|
||||||
npm run package-from-local-build
|
|
||||||
npm pkg set "optionalDependencies.@sharpen/sharp-linux-arm=file:./npm/linux-arm"
|
|
||||||
npm run clean
|
|
||||||
npm install --ignore-scripts
|
|
||||||
npx mocha --no-config --spec=test/unit/io.js
|
|
||||||
[[ -n $prebuild_upload ]] && npx prebuild || true
|
|
||||||
macstadium-runner:
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
name: ${{ matrix.platform }} - Node.js ${{ matrix.nodejs_version_major }} ${{ matrix.prebuild && '- prebuild' }}
|
name: "build-linuxmusl-arm64 [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
|
||||||
runs-on: macos-m1
|
runs-on: ubuntu-24.04-arm
|
||||||
|
container:
|
||||||
|
image: ${{ matrix.container }}
|
||||||
|
volumes:
|
||||||
|
- /:/host
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- nodejs_arch: x64
|
- container: node:18-alpine3.17
|
||||||
nodejs_version: "^18.17.0"
|
nodejs_version_major: 18
|
||||||
nodejs_version_major: 18
|
package: true
|
||||||
platform: darwin-x64
|
- container: node:20-alpine3.18
|
||||||
- nodejs_arch: arm64
|
nodejs_version_major: 20
|
||||||
nodejs_version: "^18.17.0"
|
|
||||||
nodejs_version_major: 18
|
|
||||||
platform: darwin-arm64
|
|
||||||
prebuild: true
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: /usr/bin/arch -arch arm64e /bin/bash -l {0}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Dependencies (Node.js)
|
- name: Allow Linux musl containers on ARM64 runners # https://github.com/actions/runner/issues/801#issuecomment-2394425757
|
||||||
uses: actions/setup-node@v3
|
shell: sh
|
||||||
with:
|
run: |
|
||||||
node-version: ${{ matrix.nodejs_version }}
|
apk add nodejs
|
||||||
architecture: ${{ matrix.nodejs_arch }}
|
sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release
|
||||||
- name: Checkout
|
cd /host/home/runner/runners/*/externals/
|
||||||
uses: actions/checkout@v4
|
rm -rf node20/*
|
||||||
|
mkdir node20/bin
|
||||||
|
ln -s /usr/bin/node node20/bin/node
|
||||||
|
- name: Dependencies
|
||||||
|
run: apk add build-base git python3 font-noto --update-cache
|
||||||
|
- uses: actions/checkout@v4
|
||||||
- name: Install
|
- name: Install
|
||||||
run: npm install --build-from-source
|
run: npm install --build-from-source
|
||||||
- name: Test
|
- name: Test
|
||||||
run: npm test
|
run: npm test
|
||||||
- name: Test packaging
|
- name: Populate npm package
|
||||||
|
if: matrix.package
|
||||||
|
run: npm run package-from-local-build
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
if: matrix.package
|
||||||
|
with:
|
||||||
|
name: linuxmusl-arm64
|
||||||
|
path: npm/linuxmusl-arm64
|
||||||
|
retention-days: 1
|
||||||
|
if-no-files-found: error
|
||||||
|
build-qemu:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
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
|
||||||
|
nodejs_arch: armv6l
|
||||||
|
nodejs_hostname: unofficial-builds.nodejs.org
|
||||||
|
nodejs_version: "18.17.0"
|
||||||
|
nodejs_version_major: 18
|
||||||
|
- platform: linux-s390x
|
||||||
|
distro: bullseye
|
||||||
|
run_on_arch: s390x
|
||||||
|
nodejs_arch: s390x
|
||||||
|
nodejs_hostname: nodejs.org
|
||||||
|
nodejs_version: "18.17.0"
|
||||||
|
nodejs_version_major: 18
|
||||||
|
- platform: linux-ppc64
|
||||||
|
distro: bullseye
|
||||||
|
run_on_arch: ppc64le
|
||||||
|
nodejs_arch: ppc64le
|
||||||
|
nodejs_hostname: nodejs.org
|
||||||
|
nodejs_version: "18.17.0"
|
||||||
|
nodejs_version_major: 18
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: uraimo/run-on-arch-action@v3
|
||||||
|
with:
|
||||||
|
arch: ${{ matrix.run_on_arch }}
|
||||||
|
distro: ${{ matrix.distro }}
|
||||||
|
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 run package-from-local-build
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.platform }}
|
||||||
|
path: npm/${{ matrix.platform }}
|
||||||
|
retention-days: 1
|
||||||
|
if-no-files-found: error
|
||||||
|
build-emscripten:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
name: "build-wasm32 [package]"
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
container: "emscripten/emsdk:4.0.10"
|
||||||
|
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
|
||||||
|
with:
|
||||||
|
node-version: "20"
|
||||||
|
- name: Install
|
||||||
|
run: emmake npm install --build-from-source
|
||||||
|
- name: Verify emscripten versions match
|
||||||
run: |
|
run: |
|
||||||
npm run package-from-local-build
|
EMSCRIPTEN_VERSION_LIBVIPS=$(node -p "require('@img/sharp-libvips-dev-wasm32/versions').emscripten")
|
||||||
npm pkg set "optionalDependencies.@sharpen/sharp-${{ matrix.platform }}=file:./npm/${{ matrix.platform }}"
|
EMSCRIPTEN_VERSION_SHARP=$(emcc -dumpversion)
|
||||||
npm run clean
|
echo "libvips built with emscripten $EMSCRIPTEN_VERSION_LIBVIPS"
|
||||||
npm install --ignore-scripts
|
echo "sharp built with emscripten $EMSCRIPTEN_VERSION_SHARP"
|
||||||
npm test
|
test "$EMSCRIPTEN_VERSION_LIBVIPS" = "$EMSCRIPTEN_VERSION_SHARP"
|
||||||
- name: Prebuild
|
- name: Test
|
||||||
if: matrix.prebuild && startsWith(github.ref, 'refs/tags/')
|
run: emmake npm test
|
||||||
env:
|
- name: Populate npm package
|
||||||
prebuild_upload: ${{ secrets.GITHUB_TOKEN }}
|
run: emmake npm run package-from-local-build
|
||||||
run: npx prebuild
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: wasm32
|
||||||
|
path: npm/wasm32
|
||||||
|
retention-days: 1
|
||||||
|
if-no-files-found: error
|
||||||
|
release:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
needs:
|
||||||
|
- build-native
|
||||||
|
- build-linuxmusl-arm-64
|
||||||
|
- build-qemu
|
||||||
|
- build-emscripten
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: npm
|
||||||
|
- name: Create npm workspace tarball
|
||||||
|
run: tar -vcaf npm-workspace.tar.xz --directory npm --exclude=from-local-build.js .
|
||||||
|
- name: Parse semver for tag
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
uses: madhead/semver-utils@v4
|
||||||
|
id: semver
|
||||||
|
with:
|
||||||
|
version: ${{ github.ref_name }}
|
||||||
|
- 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: "docs/src/content/docs/changelog/v${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}.${{ steps.semver.outputs.patch }}.md"
|
||||||
|
194
.github/workflows/npm.yml
vendored
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
name: "CI: npm smoke test"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v**"
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-smoke-test:
|
||||||
|
name: "${{ github.ref_name }} ${{ matrix.name }}"
|
||||||
|
runs-on: ${{ matrix.runs-on }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: linux-x64-node-npm
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
runtime: node
|
||||||
|
package-manager: npm
|
||||||
|
- name: linux-x64-node-pnpm
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
runtime: node
|
||||||
|
package-manager: pnpm
|
||||||
|
- name: linux-x64-node-yarn
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn
|
||||||
|
- name: linux-x64-node-yarn-pnp
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn-pnp
|
||||||
|
- name: linux-x64-node-yarn-v1
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn-v1
|
||||||
|
- name: linux-x64-deno
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
runtime: deno
|
||||||
|
- name: linux-x64-bun
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
runtime: bun
|
||||||
|
|
||||||
|
- name: darwin-x64-node-npm
|
||||||
|
runs-on: macos-13
|
||||||
|
runtime: node
|
||||||
|
package-manager: npm
|
||||||
|
- name: darwin-x64-node-pnpm
|
||||||
|
runs-on: macos-13
|
||||||
|
runtime: node
|
||||||
|
package-manager: pnpm
|
||||||
|
- name: darwin-x64-node-yarn
|
||||||
|
runs-on: macos-13
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn
|
||||||
|
- name: darwin-x64-node-yarn-pnp
|
||||||
|
runs-on: macos-13
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn-pnp
|
||||||
|
- name: darwin-x64-node-yarn-v1
|
||||||
|
runs-on: macos-13
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn-v1
|
||||||
|
- name: darwin-x64-deno
|
||||||
|
runs-on: macos-13
|
||||||
|
runtime: deno
|
||||||
|
- name: darwin-x64-bun
|
||||||
|
runs-on: macos-13
|
||||||
|
runtime: bun
|
||||||
|
|
||||||
|
- name: win32-x64-node-npm
|
||||||
|
runs-on: windows-2022
|
||||||
|
runtime: node
|
||||||
|
package-manager: npm
|
||||||
|
- name: win32-x64-node-pnpm
|
||||||
|
runs-on: windows-2022
|
||||||
|
runtime: node
|
||||||
|
package-manager: pnpm
|
||||||
|
- name: win32-x64-node-yarn
|
||||||
|
runs-on: windows-2022
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn
|
||||||
|
- name: win32-x64-node-yarn-pnp
|
||||||
|
runs-on: windows-2022
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn-pnp
|
||||||
|
- name: win32-x64-node-yarn-v1
|
||||||
|
runs-on: windows-2022
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn-v1
|
||||||
|
- name: win32-x64-deno
|
||||||
|
runs-on: windows-2022
|
||||||
|
runtime: deno
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install Node.js
|
||||||
|
if: ${{ matrix.runtime == 'node' }}
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
- name: Install pnpm
|
||||||
|
if: ${{ matrix.package-manager == 'pnpm' }}
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 8
|
||||||
|
- name: Install Deno
|
||||||
|
if: ${{ matrix.runtime == 'deno' }}
|
||||||
|
uses: denoland/setup-deno@v1
|
||||||
|
with:
|
||||||
|
deno-version: v1.x
|
||||||
|
- name: Install Bun
|
||||||
|
if: ${{ matrix.runtime == 'bun' }}
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: latest
|
||||||
|
|
||||||
|
- name: Version
|
||||||
|
id: version
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
core.setOutput('semver', context.ref.replace('refs/tags/v',''))
|
||||||
|
- name: Create package.json
|
||||||
|
uses: DamianReeves/write-file-action@v1.3
|
||||||
|
with:
|
||||||
|
path: package.json
|
||||||
|
contents: |
|
||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"sharp": "${{ steps.version.outputs.semver }}"
|
||||||
|
},
|
||||||
|
"type": "module"
|
||||||
|
}
|
||||||
|
- name: Create release.mjs
|
||||||
|
uses: DamianReeves/write-file-action@v1.3
|
||||||
|
with:
|
||||||
|
path: release.mjs
|
||||||
|
contents: |
|
||||||
|
import { deepStrictEqual } from 'node:assert';
|
||||||
|
import sharp from 'sharp';
|
||||||
|
deepStrictEqual(['.jpg', '.jpeg', '.jpe', '.jfif'], sharp.format.jpeg.input.fileSuffix);
|
||||||
|
|
||||||
|
- name: Run with Node.js + npm
|
||||||
|
if: ${{ matrix.package-manager == 'npm' }}
|
||||||
|
run: |
|
||||||
|
npm install --ignore-scripts
|
||||||
|
node release.mjs
|
||||||
|
|
||||||
|
- name: Run with Node.js + pnpm
|
||||||
|
if: ${{ matrix.package-manager == 'pnpm' }}
|
||||||
|
run: |
|
||||||
|
pnpm install --ignore-scripts
|
||||||
|
node release.mjs
|
||||||
|
|
||||||
|
- name: Run with Node.js + yarn
|
||||||
|
if: ${{ matrix.package-manager == 'yarn' }}
|
||||||
|
run: |
|
||||||
|
corepack enable
|
||||||
|
yarn set version stable
|
||||||
|
yarn config set enableImmutableInstalls false
|
||||||
|
yarn config set enableScripts false
|
||||||
|
yarn config set nodeLinker node-modules
|
||||||
|
yarn install
|
||||||
|
node release.mjs
|
||||||
|
|
||||||
|
- name: Run with Node.js + yarn pnp
|
||||||
|
if: ${{ matrix.package-manager == 'yarn-pnp' }}
|
||||||
|
run: |
|
||||||
|
corepack enable
|
||||||
|
yarn set version stable
|
||||||
|
yarn config set enableImmutableInstalls false
|
||||||
|
yarn config set enableScripts false
|
||||||
|
yarn config set nodeLinker pnp
|
||||||
|
yarn install
|
||||||
|
yarn node release.mjs
|
||||||
|
|
||||||
|
- name: Run with Node.js + yarn v1
|
||||||
|
if: ${{ matrix.package-manager == 'yarn-v1' }}
|
||||||
|
run: |
|
||||||
|
corepack enable
|
||||||
|
yarn set version classic
|
||||||
|
yarn install
|
||||||
|
node release.mjs
|
||||||
|
|
||||||
|
- name: Run with Deno
|
||||||
|
if: ${{ matrix.runtime == 'deno' }}
|
||||||
|
run: deno run --allow-read --allow-ffi release.mjs
|
||||||
|
|
||||||
|
- name: Run with Bun
|
||||||
|
if: ${{ matrix.runtime == 'bun' }}
|
||||||
|
run: |
|
||||||
|
bun install --ignore-scripts
|
||||||
|
bun release.mjs
|
10
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
build
|
src/build
|
||||||
|
src/node_modules
|
||||||
node_modules
|
node_modules
|
||||||
/coverage
|
/coverage
|
||||||
npm/*/*
|
npm/*/*
|
||||||
@ -7,14 +8,11 @@ test/bench/node_modules
|
|||||||
test/fixtures/output*
|
test/fixtures/output*
|
||||||
test/fixtures/vips-properties.xml
|
test/fixtures/vips-properties.xml
|
||||||
test/leak/libvips.supp
|
test/leak/libvips.supp
|
||||||
test/saliency/report.json
|
|
||||||
test/saliency/Image*
|
|
||||||
test/saliency/[Uu]serData*
|
|
||||||
!test/saliency/userData.js
|
|
||||||
.gitattributes
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.nyc_output
|
.nyc_output
|
||||||
.vscode/
|
.vscode/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
.idea
|
.idea
|
||||||
.firebase
|
.firebase
|
||||||
|
.astro
|
||||||
|
docs/dist
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"runtime": "napi",
|
|
||||||
"include-regex": "(sharp-.+\\.node|libvips-.+\\.dll|libglib-.+\\.dll|libgobject-.+\\.dll)",
|
|
||||||
"prerelease": true,
|
|
||||||
"strip": true
|
|
||||||
}
|
|
10
README.md
@ -1,11 +1,15 @@
|
|||||||
# sharp
|
# sharp
|
||||||
|
|
||||||
<img src="https://cdn.jsdelivr.net/gh/lovell/sharp@main/docs/image/sharp-logo.svg" width="160" height="160" alt="sharp logo" align="right">
|
<img src="https://sharp.pixelplumbing.com/sharp-logo.svg" width="160" height="160" alt="sharp logo" align="right">
|
||||||
|
|
||||||
The typical use case for this high speed Node.js module
|
The typical use case for this high speed Node-API module
|
||||||
is to convert large images in common formats to
|
is to convert large images in common formats to
|
||||||
smaller, web-friendly JPEG, PNG, WebP, GIF and AVIF images of varying dimensions.
|
smaller, web-friendly JPEG, PNG, WebP, GIF and AVIF images of varying dimensions.
|
||||||
|
|
||||||
|
It can be used with all JavaScript runtimes
|
||||||
|
that provide support for Node-API v9, including
|
||||||
|
Node.js (^18.17.0 or >= 20.3.0), Deno and Bun.
|
||||||
|
|
||||||
Resizing an image is typically 4x-5x faster than using the
|
Resizing an image is typically 4x-5x faster than using the
|
||||||
quickest ImageMagick and GraphicsMagick settings
|
quickest ImageMagick and GraphicsMagick settings
|
||||||
due to its use of [libvips](https://github.com/libvips/libvips).
|
due to its use of [libvips](https://github.com/libvips/libvips).
|
||||||
@ -16,7 +20,7 @@ Lanczos resampling ensures quality is not sacrificed for speed.
|
|||||||
As well as image resizing, operations such as
|
As well as image resizing, operations such as
|
||||||
rotation, extraction, compositing and gamma correction are available.
|
rotation, extraction, compositing and gamma correction are available.
|
||||||
|
|
||||||
Most modern macOS, Windows and Linux systems running Node.js >= 18.17.0
|
Most modern macOS, Windows and Linux systems
|
||||||
do not require any additional install or runtime dependencies.
|
do not require any additional install or runtime dependencies.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
90
docs/astro.config.mjs
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
// @ts-check
|
||||||
|
import { defineConfig } from 'astro/config';
|
||||||
|
import starlight from '@astrojs/starlight';
|
||||||
|
import starlightAutoSidebar from 'starlight-auto-sidebar';
|
||||||
|
|
||||||
|
import { version } from '../package.json';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
site: 'https://sharp.pixelplumbing.com',
|
||||||
|
integrations: [
|
||||||
|
starlight({
|
||||||
|
title: 'sharp',
|
||||||
|
description:
|
||||||
|
'High performance Node.js image processing. The fastest module to resize JPEG, PNG, WebP and TIFF images.',
|
||||||
|
logo: {
|
||||||
|
src: './src/assets/sharp-logo.svg',
|
||||||
|
alt: '#'
|
||||||
|
},
|
||||||
|
customCss: ['./src/styles/custom.css'],
|
||||||
|
head: [{
|
||||||
|
tag: 'meta',
|
||||||
|
attrs: {
|
||||||
|
'http-equiv': 'Content-Security-Policy',
|
||||||
|
content: "default-src 'self'; connect-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://static.cloudflareinsights.com/beacon.min.js/;"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
tag: 'link',
|
||||||
|
attrs: {
|
||||||
|
rel: 'author',
|
||||||
|
href: '/humans.txt',
|
||||||
|
type: 'text/plain'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
tag: 'script',
|
||||||
|
attrs: {
|
||||||
|
type: 'application/ld+json'
|
||||||
|
},
|
||||||
|
content: JSON.stringify({
|
||||||
|
'@context': 'https://schema.org',
|
||||||
|
'@type': 'SoftwareSourceCode',
|
||||||
|
name: 'sharp',
|
||||||
|
description: 'High performance Node.js image processing',
|
||||||
|
url: 'https://sharp.pixelplumbing.com',
|
||||||
|
codeRepository: 'https://github.com/lovell/sharp',
|
||||||
|
programmingLanguage: ['JavaScript', 'C++'],
|
||||||
|
runtimePlatform: 'Node.js',
|
||||||
|
copyrightHolder: {
|
||||||
|
'@context': 'https://schema.org',
|
||||||
|
'@type': 'Person',
|
||||||
|
name: 'Lovell Fuller'
|
||||||
|
},
|
||||||
|
copyrightYear: 2013,
|
||||||
|
license: 'https://www.apache.org/licenses/LICENSE-2.0'
|
||||||
|
})
|
||||||
|
}],
|
||||||
|
sidebar: [
|
||||||
|
{ label: 'Home', link: '/' },
|
||||||
|
{ label: 'Installation', slug: 'install' },
|
||||||
|
{
|
||||||
|
label: 'API',
|
||||||
|
items: [
|
||||||
|
{ label: 'Constructor', slug: 'api-constructor' },
|
||||||
|
{ label: 'Input metadata', slug: 'api-input' },
|
||||||
|
{ label: 'Output options', slug: 'api-output' },
|
||||||
|
{ label: 'Resizing images', slug: 'api-resize' },
|
||||||
|
{ label: 'Compositing images', slug: 'api-composite' },
|
||||||
|
{ label: 'Image operations', slug: 'api-operation' },
|
||||||
|
{ label: 'Colour manipulation', slug: 'api-colour' },
|
||||||
|
{ label: 'Channel manipulation', slug: 'api-channel' },
|
||||||
|
{ label: 'Global properties', slug: 'api-utility' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ label: 'Performance', slug: 'performance' },
|
||||||
|
{
|
||||||
|
label: 'Changelog',
|
||||||
|
collapsed: true,
|
||||||
|
autogenerate: { directory: 'changelog' }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
social: [
|
||||||
|
{ icon: 'openCollective', label: 'Open Collective', href: 'https://opencollective.com/libvips' },
|
||||||
|
{ icon: 'github', label: 'GitHub', href: 'https://github.com/lovell/sharp' }
|
||||||
|
],
|
||||||
|
plugins: [starlightAutoSidebar()]
|
||||||
|
})
|
||||||
|
],
|
||||||
|
redirects: {
|
||||||
|
'/changelog': `/changelog/v${version}`
|
||||||
|
}
|
||||||
|
});
|
@ -1,38 +0,0 @@
|
|||||||
// Copyright 2013 Lovell Fuller and others.
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const fs = require('fs').promises;
|
|
||||||
const path = require('path');
|
|
||||||
const jsdoc2md = require('jsdoc-to-markdown');
|
|
||||||
|
|
||||||
[
|
|
||||||
'constructor',
|
|
||||||
'input',
|
|
||||||
'resize',
|
|
||||||
'composite',
|
|
||||||
'operation',
|
|
||||||
'colour',
|
|
||||||
'channel',
|
|
||||||
'output',
|
|
||||||
'utility'
|
|
||||||
].forEach(async (m) => {
|
|
||||||
const input = path.join('lib', `${m}.js`);
|
|
||||||
const output = path.join('docs', `api-${m}.md`);
|
|
||||||
|
|
||||||
const ast = await jsdoc2md.getTemplateData({ files: input });
|
|
||||||
const markdown = await jsdoc2md.render({
|
|
||||||
data: ast,
|
|
||||||
'global-index-format': 'none',
|
|
||||||
'module-index-format': 'none'
|
|
||||||
});
|
|
||||||
|
|
||||||
const cleanMarkdown = markdown
|
|
||||||
.replace(/(## )([A-Za-z0-9]+)([^\n]*)/g, '$1$2\n> $2$3\n') // simplify headings to match those of documentationjs, ensures existing URLs work
|
|
||||||
.replace(/<a name="[A-Za-z0-9+]+"><\/a>/g, '') // remove anchors, let docute add these (at markdown to HTML render time)
|
|
||||||
.replace(/\*\*Kind\*\*: global[^\n]+/g, '') // remove all "global" Kind labels (requires JSDoc refactoring)
|
|
||||||
.trim();
|
|
||||||
|
|
||||||
await fs.writeFile(output, cleanMarkdown);
|
|
||||||
});
|
|
42
docs/build.mjs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// Copyright 2013 Lovell Fuller and others.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import fs from 'node:fs/promises';
|
||||||
|
import path from 'node:path';
|
||||||
|
import jsdoc2md from 'jsdoc-to-markdown';
|
||||||
|
|
||||||
|
const pages = {
|
||||||
|
constructor: 'Constructor',
|
||||||
|
input: 'Input metadata',
|
||||||
|
resize: 'Resizing images',
|
||||||
|
composite: 'Compositing images',
|
||||||
|
operation: 'Image operations',
|
||||||
|
colour: 'Colour manipulation',
|
||||||
|
channel: 'Channel manipulation',
|
||||||
|
output: 'Output options',
|
||||||
|
utility: 'Global properties'
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.keys(pages).forEach(async (m) => {
|
||||||
|
const input = path.join('lib', `${m}.js`);
|
||||||
|
const output = path.join('docs', 'src', 'content', 'docs', `api-${m}.md`);
|
||||||
|
|
||||||
|
const ast = await jsdoc2md.getTemplateData({ files: input });
|
||||||
|
const markdown = await jsdoc2md.render({
|
||||||
|
data: ast,
|
||||||
|
'global-index-format': 'none',
|
||||||
|
'module-index-format': 'none'
|
||||||
|
});
|
||||||
|
|
||||||
|
const cleanMarkdown =
|
||||||
|
`---\n# This file was auto-generated from JSDoc in lib/${m}.js\ntitle: ${pages[m]}\n---\n\n` +
|
||||||
|
markdown
|
||||||
|
.replace(/(## )([A-Za-z0-9]+)([^\n]*)/g, '$1$2\n> $2$3\n') // simplify headings
|
||||||
|
.replace(/<a name="[A-Za-z0-9+]+"><\/a>/g, '') // remove anchors
|
||||||
|
.replace(/\*\*Kind\*\*: global[^\n]+/g, '') // remove all "global" Kind labels (requires JSDoc refactoring)
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
await fs.writeFile(output, cleanMarkdown);
|
||||||
|
});
|
1911
docs/changelog.md
1
docs/docute.min.js
vendored
@ -1,14 +1,7 @@
|
|||||||
{
|
{
|
||||||
"hosting": {
|
"hosting": {
|
||||||
"site": "pixelplumbing-sharp",
|
"site": "pixelplumbing-sharp",
|
||||||
"public": ".",
|
"public": "dist",
|
||||||
"ignore": [
|
|
||||||
".*",
|
|
||||||
"build.js",
|
|
||||||
"firebase.json",
|
|
||||||
"image/**",
|
|
||||||
"search-index/**"
|
|
||||||
],
|
|
||||||
"headers": [
|
"headers": [
|
||||||
{
|
{
|
||||||
"source": "**",
|
"source": "**",
|
||||||
@ -18,99 +11,6 @@
|
|||||||
{ "key": "X-Frame-Options", "value": "SAMEORIGIN" }
|
{ "key": "X-Frame-Options", "value": "SAMEORIGIN" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"redirects": [
|
|
||||||
{
|
|
||||||
"source": "**/install/**",
|
|
||||||
"destination": "/install",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "/page/install",
|
|
||||||
"destination": "/install",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "**/api-constructor/**",
|
|
||||||
"destination": "/api-constructor",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "**/api-input/**",
|
|
||||||
"destination": "/api-input",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "**/api-output/**",
|
|
||||||
"destination": "/api-output",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "**/api-resize/**",
|
|
||||||
"destination": "/api-resize",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "**/api-compsite/**",
|
|
||||||
"destination": "/api-compsite",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "**/api-operation/**",
|
|
||||||
"destination": "/api-operation",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "**/api-colour/**",
|
|
||||||
"destination": "/api-colour",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "**/api-channel/**",
|
|
||||||
"destination": "/api-channel",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "**/api-utility/**",
|
|
||||||
"destination": "/api-utility",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "/page/api",
|
|
||||||
"destination": "/api-constructor",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "**/performance/**",
|
|
||||||
"destination": "/performance",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "/page/performance",
|
|
||||||
"destination": "/performance",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "**/changelog/**",
|
|
||||||
"destination": "/changelog",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "/page/changelog",
|
|
||||||
"destination": "/changelog",
|
|
||||||
"type": 301
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "/en/**",
|
|
||||||
"destination": "/",
|
|
||||||
"type": 301
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"rewrites": [
|
|
||||||
{
|
|
||||||
"source": "**",
|
|
||||||
"destination": "/index.html"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 652 B |
Before Width: | Height: | Size: 2.8 KiB |
206
docs/index.html
18
docs/package.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "sharp-docs",
|
||||||
|
"type": "module",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "astro dev",
|
||||||
|
"start": "astro dev",
|
||||||
|
"build": "astro build",
|
||||||
|
"preview": "astro preview",
|
||||||
|
"astro": "astro"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@astrojs/starlight": "^0.34.6",
|
||||||
|
"astro": "^5.11.1",
|
||||||
|
"starlight-auto-sidebar": "^0.1.2"
|
||||||
|
}
|
||||||
|
}
|
@ -1,111 +0,0 @@
|
|||||||
# Performance
|
|
||||||
|
|
||||||
A test to benchmark the performance of this module relative to alternatives.
|
|
||||||
|
|
||||||
Greater libvips performance can be expected with caching enabled (default)
|
|
||||||
and using 8+ core machines, especially those with larger L1/L2 CPU caches.
|
|
||||||
|
|
||||||
The I/O limits of the relevant (de)compression library will generally determine maximum throughput.
|
|
||||||
|
|
||||||
## Contenders
|
|
||||||
|
|
||||||
* [jimp](https://www.npmjs.com/package/jimp) v0.22.7 - Image processing in pure JavaScript.
|
|
||||||
* [imagemagick](https://www.npmjs.com/package/imagemagick) v0.1.3 - Supports filesystem only and "*has been unmaintained for a long time*".
|
|
||||||
* [gm](https://www.npmjs.com/package/gm) v1.25.0 - Fully featured wrapper around GraphicsMagick's `gm` command line utility.
|
|
||||||
* [@squoosh/lib](https://www.npmjs.com/package/@squoosh/lib) v0.4.0 - Image libraries transpiled to WebAssembly, includes GPLv3 code, but "*Project no longer maintained*".
|
|
||||||
* [@squoosh/cli](https://www.npmjs.com/package/@squoosh/cli) v0.7.3 - Command line wrapper around `@squoosh/lib`, avoids GPLv3 by spawning process, but "*Project no longer maintained*".
|
|
||||||
* sharp v0.32.0 / libvips v8.14.2 - Caching within libvips disabled to ensure a fair comparison.
|
|
||||||
|
|
||||||
## Environment
|
|
||||||
|
|
||||||
### AMD64
|
|
||||||
|
|
||||||
* AWS EC2 us-east-2 [c6a.xlarge](https://aws.amazon.com/ec2/instance-types/c6a/) (4x AMD EPYC 7R13)
|
|
||||||
* Ubuntu 22.04 20230303 (ami-0122295b0eb922138)
|
|
||||||
* Node.js 16.19.1
|
|
||||||
|
|
||||||
### ARM64
|
|
||||||
|
|
||||||
* AWS EC2 us-east-2 [c7g.xlarge](https://aws.amazon.com/ec2/instance-types/c7g/) (4x ARM Graviton3)
|
|
||||||
* Ubuntu 22.04 20230303 (ami-0af198159897e7a29)
|
|
||||||
* Node.js 16.19.1
|
|
||||||
|
|
||||||
## Task: JPEG
|
|
||||||
|
|
||||||
Decompress a 2725x2225 JPEG image,
|
|
||||||
resize to 720x588 using Lanczos 3 resampling (where available),
|
|
||||||
then compress to JPEG at a "quality" setting of 80.
|
|
||||||
|
|
||||||
Note: jimp does not support Lanczos 3, bicubic resampling used instead.
|
|
||||||
|
|
||||||
#### Results: JPEG (AMD64)
|
|
||||||
|
|
||||||
| Module | Input | Output | Ops/sec | Speed-up |
|
|
||||||
| :----------------- | :----- | :----- | ------: | -------: |
|
|
||||||
| jimp | buffer | buffer | 0.84 | 1.0 |
|
|
||||||
| squoosh-cli | file | file | 1.07 | 1.3 |
|
|
||||||
| squoosh-lib | buffer | buffer | 1.82 | 2.2 |
|
|
||||||
| gm | buffer | buffer | 8.41 | 10.0 |
|
|
||||||
| gm | file | file | 8.45 | 10.0 |
|
|
||||||
| imagemagick | file | file | 8.77 | 10.4 |
|
|
||||||
| sharp | stream | stream | 36.36 | 43.3 |
|
|
||||||
| sharp | file | file | 38.67 | 46.0 |
|
|
||||||
| sharp | buffer | buffer | 39.44 | 47.0 |
|
|
||||||
|
|
||||||
#### Results: JPEG (ARM64)
|
|
||||||
|
|
||||||
| Module | Input | Output | Ops/sec | Speed-up |
|
|
||||||
| :----------------- | :----- | :----- | ------: | -------: |
|
|
||||||
| jimp | buffer | buffer | 1.02 | 1.0 |
|
|
||||||
| squoosh-cli | file | file | 1.11 | 1.1 |
|
|
||||||
| squoosh-lib | buffer | buffer | 2.08 | 2.0 |
|
|
||||||
| gm | buffer | buffer | 8.80 | 8.6 |
|
|
||||||
| gm | file | file | 10.05 | 9.9 |
|
|
||||||
| imagemagick | file | file | 10.28 | 10.1 |
|
|
||||||
| sharp | stream | stream | 26.87 | 26.3 |
|
|
||||||
| sharp | file | file | 27.88 | 27.3 |
|
|
||||||
| sharp | buffer | buffer | 28.40 | 27.8 |
|
|
||||||
|
|
||||||
## Task: PNG
|
|
||||||
|
|
||||||
Decompress a 2048x1536 RGBA PNG image,
|
|
||||||
premultiply the alpha channel,
|
|
||||||
resize to 720x540 using Lanczos 3 resampling (where available),
|
|
||||||
unpremultiply then compress as PNG with a "default" zlib compression level of 6
|
|
||||||
and without adaptive filtering.
|
|
||||||
|
|
||||||
Note: jimp does not support premultiply/unpremultiply.
|
|
||||||
|
|
||||||
### Results: PNG (AMD64)
|
|
||||||
|
|
||||||
| Module | Input | Output | Ops/sec | Speed-up |
|
|
||||||
| :----------------- | :----- | :----- | ------: | -------: |
|
|
||||||
| squoosh-cli | file | file | 0.40 | 1.0 |
|
|
||||||
| squoosh-lib | buffer | buffer | 0.47 | 1.2 |
|
|
||||||
| gm | file | file | 6.47 | 16.2 |
|
|
||||||
| jimp | buffer | buffer | 6.60 | 16.5 |
|
|
||||||
| imagemagick | file | file | 7.08 | 17.7 |
|
|
||||||
| sharp | file | file | 17.80 | 44.5 |
|
|
||||||
| sharp | buffer | buffer | 18.02 | 45.0 |
|
|
||||||
|
|
||||||
### Results: PNG (ARM64)
|
|
||||||
|
|
||||||
| Module | Input | Output | Ops/sec | Speed-up |
|
|
||||||
| :----------------- | :----- | :----- | ------: | -------: |
|
|
||||||
| squoosh-cli | file | file | 0.40 | 1.0 |
|
|
||||||
| squoosh-lib | buffer | buffer | 0.48 | 1.2 |
|
|
||||||
| gm | file | file | 7.20 | 18.0 |
|
|
||||||
| jimp | buffer | buffer | 7.62 | 19.1 |
|
|
||||||
| imagemagick | file | file | 7.96 | 19.9 |
|
|
||||||
| sharp | file | file | 12.97 | 32.4 |
|
|
||||||
| sharp | buffer | buffer | 13.12 | 32.8 |
|
|
||||||
|
|
||||||
## Running the benchmark test
|
|
||||||
|
|
||||||
Requires Docker.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/lovell/sharp.git
|
|
||||||
cd sharp/test/bench
|
|
||||||
./run-with-docker.sh
|
|
||||||
```
|
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 508 B |
@ -28,7 +28,7 @@ Name: Brandon Aaron
|
|||||||
GitHub: https://github.com/brandonaaron
|
GitHub: https://github.com/brandonaaron
|
||||||
|
|
||||||
Name: Andreas Lind
|
Name: Andreas Lind
|
||||||
GitHub: https://github.com/papandreouGitHub:
|
GitHub: https://github.com/papandreou
|
||||||
|
|
||||||
Name: Maurus Cuelenaere
|
Name: Maurus Cuelenaere
|
||||||
GitHub: https://github.com/mcuelenaere
|
GitHub: https://github.com/mcuelenaere
|
||||||
@ -261,7 +261,7 @@ GitHub: https://github.com/brahima
|
|||||||
Name: Anton Marsden
|
Name: Anton Marsden
|
||||||
GitHub: https://github.com/antonmarsden
|
GitHub: https://github.com/antonmarsden
|
||||||
|
|
||||||
Name: Marcos Casagrande
|
Name: Marcos Casagrande
|
||||||
GitHub: https://github.com/marcosc90
|
GitHub: https://github.com/marcosc90
|
||||||
|
|
||||||
Name: Emanuel Jöbstl
|
Name: Emanuel Jöbstl
|
||||||
@ -275,3 +275,51 @@ GitHub: https://github.com/LachlanNewman
|
|||||||
|
|
||||||
Name: BJJ
|
Name: BJJ
|
||||||
GitHub: https://github.com/bianjunjie1981
|
GitHub: https://github.com/bianjunjie1981
|
||||||
|
|
||||||
|
Name: Dennis Beatty
|
||||||
|
GitHub: https://github.com/dnsbty
|
||||||
|
|
||||||
|
Name: Ingvar Stepanyan
|
||||||
|
GitHub: https://github.com/RReverser
|
||||||
|
|
||||||
|
Name: Tamás András Horváth
|
||||||
|
GitHub: https://github.com/icetee
|
||||||
|
|
||||||
|
Name: Aaron Che
|
||||||
|
GitHub: https://github.com/yolopunk
|
||||||
|
|
||||||
|
Name: Mert Alev
|
||||||
|
GitHub: https://github.com/mertalev
|
||||||
|
|
||||||
|
Name: Adriaan Meuris
|
||||||
|
GitHub: https://github.com/adriaanmeuris
|
||||||
|
|
||||||
|
Name: Richard Hillmann
|
||||||
|
GitHub: https://github.com/project0
|
||||||
|
|
||||||
|
Name: Pongsatorn Manusopit
|
||||||
|
GitHub: https://github.com/ton11797
|
||||||
|
|
||||||
|
Name: Nathan Keynes
|
||||||
|
GitHub: https://github.com/nkeynes
|
||||||
|
|
||||||
|
Name: Sumit D
|
||||||
|
GitHub: https://github.com/sumitd2
|
||||||
|
|
||||||
|
Name: Caleb Meredith
|
||||||
|
GitHub: https://github.com/calebmer
|
||||||
|
|
||||||
|
Name: Don Denton
|
||||||
|
GitHub: https://github.com/happycollision
|
||||||
|
|
||||||
|
Name: Florent Zabera
|
||||||
|
GitHub: https://github.com/florentzabera
|
||||||
|
|
||||||
|
Name: Quentin Pinçon
|
||||||
|
GitHub: https://github.com/qpincon
|
||||||
|
|
||||||
|
Name: Hans Chen
|
||||||
|
GitHub: https://github.com/hans00
|
||||||
|
|
||||||
|
Name: Thibaut Patel
|
||||||
|
GitHub: https://github.com/tpatel
|
4
docs/public/robots.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||
|
|
||||||
|
Sitemap: https://sharp.pixelplumbing.com/sitemap-index.xml
|
Before Width: | Height: | Size: 929 B After Width: | Height: | Size: 929 B |
5
docs/public/sharp-logo.svg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="86 86 550 550">
|
||||||
|
<!-- Creative Commons CC0 1.0 Universal Public Domain Dedication -->
|
||||||
|
<path fill="none" stroke="#9c0" stroke-width="80" d="M258.411 285.777l200.176-26.8M244.113 466.413L451.44 438.66M451.441 438.66V238.484M451.441 88.363v171.572l178.725-23.917M270.323 255.602V477.22M272.71 634.17V462.591L93.984 486.515"/>
|
||||||
|
<path fill="none" stroke="#090" stroke-width="80" d="M451.441 610.246V438.66l178.725-23.91M269.688 112.59v171.58L90.964 308.093"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 508 B |
@ -1,2 +0,0 @@
|
|||||||
User-agent: *
|
|
||||||
Disallow:
|
|
@ -1,64 +0,0 @@
|
|||||||
// Copyright 2013 Lovell Fuller and others.
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
const { extractDescription, extractKeywords, extractParameters } = require('./extract');
|
|
||||||
|
|
||||||
const searchIndex = [];
|
|
||||||
|
|
||||||
// Install
|
|
||||||
const contents = fs.readFileSync(path.join(__dirname, '..', 'install.md'), 'utf8');
|
|
||||||
const matches = contents.matchAll(
|
|
||||||
/## (?<title>[A-Za-z0-9 ]+)\n\n(?<body>[^#]+)/gs
|
|
||||||
);
|
|
||||||
for (const match of matches) {
|
|
||||||
const { title, body } = match.groups;
|
|
||||||
const description = extractDescription(body);
|
|
||||||
|
|
||||||
searchIndex.push({
|
|
||||||
t: title,
|
|
||||||
d: description,
|
|
||||||
k: extractKeywords(`${title} ${description}`),
|
|
||||||
l: `/install#${title.toLowerCase().replace(/ /g, '-')}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// API
|
|
||||||
[
|
|
||||||
'constructor',
|
|
||||||
'input',
|
|
||||||
'output',
|
|
||||||
'resize',
|
|
||||||
'composite',
|
|
||||||
'operation',
|
|
||||||
'channel',
|
|
||||||
'colour',
|
|
||||||
'utility'
|
|
||||||
].forEach((section) => {
|
|
||||||
const contents = fs.readFileSync(path.join(__dirname, '..', `api-${section}.md`), 'utf8');
|
|
||||||
const matches = contents.matchAll(
|
|
||||||
/## (?<title>[A-Za-z]+)\n[^\n]+\n(?<firstparagraph>.+?)\n\n.+?(?<parameters>\| Param .+?\n\n)?\*\*Example/gs
|
|
||||||
);
|
|
||||||
for (const match of matches) {
|
|
||||||
const { title, firstparagraph, parameters } = match.groups;
|
|
||||||
const description = firstparagraph.startsWith('###')
|
|
||||||
? 'Constructor'
|
|
||||||
: extractDescription(firstparagraph);
|
|
||||||
const parameterNames = parameters ? extractParameters(parameters) : '';
|
|
||||||
|
|
||||||
searchIndex.push({
|
|
||||||
t: title,
|
|
||||||
d: description,
|
|
||||||
k: extractKeywords(`${title} ${description} ${parameterNames}`),
|
|
||||||
l: `/api-${section}#${title.toLowerCase()}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fs.writeFileSync(
|
|
||||||
path.join(__dirname, '..', 'search-index.json'),
|
|
||||||
JSON.stringify(searchIndex)
|
|
||||||
);
|
|
@ -1,34 +0,0 @@
|
|||||||
// Copyright 2013 Lovell Fuller and others.
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const stopWords = require('./stop-words');
|
|
||||||
|
|
||||||
const extractDescription = (str) =>
|
|
||||||
str
|
|
||||||
.replace(/### Examples.*/sg, '')
|
|
||||||
.replace(/\(http[^)]+/g, '')
|
|
||||||
.replace(/\s+/g, ' ')
|
|
||||||
.replace(/[^A-Za-z0-9_/\-,. ]/g, '')
|
|
||||||
.replace(/\s+/g, ' ')
|
|
||||||
.substring(0, 200)
|
|
||||||
.trim();
|
|
||||||
|
|
||||||
const extractParameters = (str) =>
|
|
||||||
[...str.matchAll(/options\.(?<name>[^.`\] ]+)/gs)]
|
|
||||||
.map((match) => match.groups.name)
|
|
||||||
.map((name) => name.replace(/([A-Z])/g, ' $1').toLowerCase())
|
|
||||||
.join(' ');
|
|
||||||
|
|
||||||
const extractKeywords = (str) =>
|
|
||||||
[
|
|
||||||
...new Set(
|
|
||||||
str
|
|
||||||
.split(/[ -/]/)
|
|
||||||
.map((word) => word.toLowerCase().replace(/[^a-z]/g, ''))
|
|
||||||
.filter((word) => word.length > 2 && word.length < 15 && !stopWords.includes(word))
|
|
||||||
)
|
|
||||||
].join(' ');
|
|
||||||
|
|
||||||
module.exports = { extractDescription, extractKeywords, extractParameters };
|
|
@ -1,135 +0,0 @@
|
|||||||
// Copyright 2013 Lovell Fuller and others.
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports = [
|
|
||||||
'about',
|
|
||||||
'after',
|
|
||||||
'all',
|
|
||||||
'allows',
|
|
||||||
'already',
|
|
||||||
'also',
|
|
||||||
'alternative',
|
|
||||||
'always',
|
|
||||||
'and',
|
|
||||||
'any',
|
|
||||||
'are',
|
|
||||||
'available',
|
|
||||||
'based',
|
|
||||||
'been',
|
|
||||||
'before',
|
|
||||||
'best',
|
|
||||||
'both',
|
|
||||||
'call',
|
|
||||||
'callback',
|
|
||||||
'can',
|
|
||||||
'containing',
|
|
||||||
'contains',
|
|
||||||
'created',
|
|
||||||
'current',
|
|
||||||
'date',
|
|
||||||
'default',
|
|
||||||
'does',
|
|
||||||
'each',
|
|
||||||
'either',
|
|
||||||
'ensure',
|
|
||||||
'entirely',
|
|
||||||
'etc',
|
|
||||||
'every',
|
|
||||||
'except',
|
|
||||||
'following',
|
|
||||||
'for',
|
|
||||||
'from',
|
|
||||||
'get',
|
|
||||||
'gets',
|
|
||||||
'given',
|
|
||||||
'has',
|
|
||||||
'have',
|
|
||||||
'how',
|
|
||||||
'image',
|
|
||||||
'implies',
|
|
||||||
'include',
|
|
||||||
'including',
|
|
||||||
'involve',
|
|
||||||
'its',
|
|
||||||
'last',
|
|
||||||
'least',
|
|
||||||
'lots',
|
|
||||||
'make',
|
|
||||||
'may',
|
|
||||||
'more',
|
|
||||||
'most',
|
|
||||||
'much',
|
|
||||||
'must',
|
|
||||||
'non',
|
|
||||||
'not',
|
|
||||||
'now',
|
|
||||||
'occur',
|
|
||||||
'occurs',
|
|
||||||
'one',
|
|
||||||
'options',
|
|
||||||
'other',
|
|
||||||
'out',
|
|
||||||
'over',
|
|
||||||
'part',
|
|
||||||
'perform',
|
|
||||||
'performs',
|
|
||||||
'please',
|
|
||||||
'pre',
|
|
||||||
'previously',
|
|
||||||
'produce',
|
|
||||||
'provide',
|
|
||||||
'provided',
|
|
||||||
'ready',
|
|
||||||
'requires',
|
|
||||||
'requiresharp',
|
|
||||||
'returned',
|
|
||||||
'run',
|
|
||||||
'same',
|
|
||||||
'see',
|
|
||||||
'set',
|
|
||||||
'sets',
|
|
||||||
'sharp',
|
|
||||||
'should',
|
|
||||||
'since',
|
|
||||||
'site',
|
|
||||||
'some',
|
|
||||||
'specified',
|
|
||||||
'spelling',
|
|
||||||
'such',
|
|
||||||
'support',
|
|
||||||
'supported',
|
|
||||||
'sure',
|
|
||||||
'take',
|
|
||||||
'task',
|
|
||||||
'than',
|
|
||||||
'that',
|
|
||||||
'the',
|
|
||||||
'their',
|
|
||||||
'then',
|
|
||||||
'there',
|
|
||||||
'therefore',
|
|
||||||
'these',
|
|
||||||
'this',
|
|
||||||
'under',
|
|
||||||
'unless',
|
|
||||||
'unmaintained',
|
|
||||||
'unsuitable',
|
|
||||||
'until',
|
|
||||||
'use',
|
|
||||||
'used',
|
|
||||||
'using',
|
|
||||||
'value',
|
|
||||||
'values',
|
|
||||||
'via',
|
|
||||||
'were',
|
|
||||||
'when',
|
|
||||||
'which',
|
|
||||||
'while',
|
|
||||||
'will',
|
|
||||||
'with',
|
|
||||||
'without',
|
|
||||||
'you',
|
|
||||||
'your'
|
|
||||||
];
|
|
5
docs/src/assets/sharp-logo.svg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="86 86 550 550">
|
||||||
|
<!-- Creative Commons CC0 1.0 Universal Public Domain Dedication -->
|
||||||
|
<path fill="none" stroke="#9c0" stroke-width="80" d="M258.411 285.777l200.176-26.8M244.113 466.413L451.44 438.66M451.441 438.66V238.484M451.441 88.363v171.572l178.725-23.917M270.323 255.602V477.22M272.71 634.17V462.591L93.984 486.515"/>
|
||||||
|
<path fill="none" stroke="#090" stroke-width="80" d="M451.441 610.246V438.66l178.725-23.91M269.688 112.59v171.58L90.964 308.093"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 508 B |
10
docs/src/content.config.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { defineCollection } from 'astro:content';
|
||||||
|
import { docsLoader } from '@astrojs/starlight/loaders';
|
||||||
|
import { docsSchema } from '@astrojs/starlight/schema';
|
||||||
|
import { autoSidebarLoader } from 'starlight-auto-sidebar/loader'
|
||||||
|
import { autoSidebarSchema } from 'starlight-auto-sidebar/schema'
|
||||||
|
|
||||||
|
export const collections = {
|
||||||
|
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
|
||||||
|
autoSidebar: defineCollection({ loader: autoSidebarLoader(), schema: autoSidebarSchema() })
|
||||||
|
};
|
@ -1,7 +1,12 @@
|
|||||||
|
---
|
||||||
|
# This file was auto-generated from JSDoc in lib/channel.js
|
||||||
|
title: Channel manipulation
|
||||||
|
---
|
||||||
|
|
||||||
## removeAlpha
|
## removeAlpha
|
||||||
> removeAlpha() ⇒ <code>Sharp</code>
|
> removeAlpha() ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel.
|
Remove alpha channels, if any. This is a no-op if the image does not have an alpha channel.
|
||||||
|
|
||||||
See also [flatten](/api-operation#flatten).
|
See also [flatten](/api-operation#flatten).
|
||||||
|
|
@ -1,7 +1,12 @@
|
|||||||
## tint
|
---
|
||||||
> tint(rgb) ⇒ <code>Sharp</code>
|
# This file was auto-generated from JSDoc in lib/colour.js
|
||||||
|
title: Colour manipulation
|
||||||
|
---
|
||||||
|
|
||||||
Tint the image using the provided chroma while preserving the image luminance.
|
## tint
|
||||||
|
> tint(tint) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
|
Tint the image using the provided colour.
|
||||||
An alpha channel may be present and will be unchanged by the operation.
|
An alpha channel may be present and will be unchanged by the operation.
|
||||||
|
|
||||||
|
|
||||||
@ -12,7 +17,7 @@ An alpha channel may be present and will be unchanged by the operation.
|
|||||||
|
|
||||||
| Param | Type | Description |
|
| Param | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| rgb | <code>string</code> \| <code>Object</code> | parsed by the [color](https://www.npmjs.org/package/color) module to extract chroma values. |
|
| tint | <code>string</code> \| <code>Object</code> | Parsed by the [color](https://www.npmjs.org/package/color) module. |
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
@ -27,9 +32,9 @@ const output = await sharp(input)
|
|||||||
|
|
||||||
Convert to 8-bit greyscale; 256 shades of grey.
|
Convert to 8-bit greyscale; 256 shades of grey.
|
||||||
This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
|
This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
|
||||||
By default the output image will be web-friendly sRGB and contain three (identical) color channels.
|
By default the output image will be web-friendly sRGB and contain three (identical) colour channels.
|
||||||
This may be overridden by other sharp operations such as `toColourspace('b-w')`,
|
This may be overridden by other sharp operations such as `toColourspace('b-w')`,
|
||||||
which will produce an output image containing one color channel.
|
which will produce an output image containing one colour channel.
|
||||||
An alpha channel may be present, and will be unchanged by the operation.
|
An alpha channel may be present, and will be unchanged by the operation.
|
||||||
|
|
||||||
|
|
||||||
@ -66,8 +71,6 @@ The input image will be converted to the provided colourspace at the start of th
|
|||||||
All operations will use this colourspace before converting to the output colourspace,
|
All operations will use this colourspace before converting to the output colourspace,
|
||||||
as defined by [toColourspace](#tocolourspace).
|
as defined by [toColourspace](#tocolourspace).
|
||||||
|
|
||||||
This feature is experimental and has not yet been fully-tested with all operations.
|
|
||||||
|
|
||||||
|
|
||||||
**Throws**:
|
**Throws**:
|
||||||
|
|
@ -1,3 +1,8 @@
|
|||||||
|
---
|
||||||
|
# This file was auto-generated from JSDoc in lib/composite.js
|
||||||
|
title: Compositing images
|
||||||
|
---
|
||||||
|
|
||||||
## composite
|
## composite
|
||||||
> composite(images) ⇒ <code>Sharp</code>
|
> composite(images) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
@ -6,8 +11,8 @@ Composite image(s) over the processed (resized, extracted etc.) image.
|
|||||||
The images to composite must be the same size or smaller than the processed image.
|
The images to composite must be the same size or smaller than the processed image.
|
||||||
If both `top` and `left` options are provided, they take precedence over `gravity`.
|
If both `top` and `left` options are provided, they take precedence over `gravity`.
|
||||||
|
|
||||||
Any resize, rotate or extract operations in the same processing pipeline
|
Other operations in the same processing pipeline (e.g. resize, rotate, flip,
|
||||||
will always be applied to the input image before composition.
|
flop, extract) will always be applied to the input image before composition.
|
||||||
|
|
||||||
The `blend` option can be one of `clear`, `source`, `over`, `in`, `out`, `atop`,
|
The `blend` option can be one of `clear`, `source`, `over`, `in`, `out`, `atop`,
|
||||||
`dest`, `dest-over`, `dest-in`, `dest-out`, `dest-atop`,
|
`dest`, `dest-over`, `dest-in`, `dest-out`, `dest-atop`,
|
||||||
@ -46,6 +51,7 @@ and https://www.cairographics.org/operators/
|
|||||||
| [images[].input.text.dpi] | <code>number</code> | <code>72</code> | the resolution (size) at which to render the text. Does not take effect if `height` is specified. |
|
| [images[].input.text.dpi] | <code>number</code> | <code>72</code> | the resolution (size) at which to render the text. Does not take effect if `height` is specified. |
|
||||||
| [images[].input.text.rgba] | <code>boolean</code> | <code>false</code> | set this to true to enable RGBA output. This is useful for colour emoji rendering, or support for Pango markup features like `<span foreground="red">Red!</span>`. |
|
| [images[].input.text.rgba] | <code>boolean</code> | <code>false</code> | set this to true to enable RGBA output. This is useful for colour emoji rendering, or support for Pango markup features like `<span foreground="red">Red!</span>`. |
|
||||||
| [images[].input.text.spacing] | <code>number</code> | <code>0</code> | text line height in points. Will use the font line height if none is specified. |
|
| [images[].input.text.spacing] | <code>number</code> | <code>0</code> | text line height in points. Will use the font line height if none is specified. |
|
||||||
|
| [images[].autoOrient] | <code>Boolean</code> | <code>false</code> | set to true to use EXIF orientation data, if present, to orient the image. |
|
||||||
| [images[].blend] | <code>String</code> | <code>'over'</code> | how to blend this image with the image below. |
|
| [images[].blend] | <code>String</code> | <code>'over'</code> | how to blend this image with the image below. |
|
||||||
| [images[].gravity] | <code>String</code> | <code>'centre'</code> | gravity at which to place the overlay. |
|
| [images[].gravity] | <code>String</code> | <code>'centre'</code> | gravity at which to place the overlay. |
|
||||||
| [images[].top] | <code>Number</code> | | the pixel offset from the top edge. |
|
| [images[].top] | <code>Number</code> | | the pixel offset from the top edge. |
|
@ -1,3 +1,8 @@
|
|||||||
|
---
|
||||||
|
# This file was auto-generated from JSDoc in lib/constructor.js
|
||||||
|
title: Constructor
|
||||||
|
---
|
||||||
|
|
||||||
## Sharp
|
## Sharp
|
||||||
> Sharp
|
> Sharp
|
||||||
|
|
||||||
@ -17,6 +22,10 @@ Non-critical problems encountered during processing are emitted as `warning` eve
|
|||||||
|
|
||||||
Implements the [stream.Duplex](http://nodejs.org/api/stream.html#stream_class_stream_duplex) class.
|
Implements the [stream.Duplex](http://nodejs.org/api/stream.html#stream_class_stream_duplex) class.
|
||||||
|
|
||||||
|
When loading more than one page/frame of an animated image,
|
||||||
|
these are combined as a vertically-stacked "toilet roll" image
|
||||||
|
where the overall height is the `pageHeight` multiplied by the number of `pages`.
|
||||||
|
|
||||||
**Throws**:
|
**Throws**:
|
||||||
|
|
||||||
- <code>Error</code> Invalid parameters
|
- <code>Error</code> Invalid parameters
|
||||||
@ -24,33 +33,34 @@ Implements the [stream.Duplex](http://nodejs.org/api/stream.html#stream_class_st
|
|||||||
|
|
||||||
| Param | Type | Default | Description |
|
| Param | Type | Default | Description |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| [input] | <code>Buffer</code> \| <code>ArrayBuffer</code> \| <code>Uint8Array</code> \| <code>Uint8ClampedArray</code> \| <code>Int8Array</code> \| <code>Uint16Array</code> \| <code>Int16Array</code> \| <code>Uint32Array</code> \| <code>Int32Array</code> \| <code>Float32Array</code> \| <code>Float64Array</code> \| <code>string</code> | | if present, can be a Buffer / ArrayBuffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image data, or a TypedArray containing raw pixel image data, or a String containing the filesystem path to an JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image file. JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present. |
|
| [input] | <code>Buffer</code> \| <code>ArrayBuffer</code> \| <code>Uint8Array</code> \| <code>Uint8ClampedArray</code> \| <code>Int8Array</code> \| <code>Uint16Array</code> \| <code>Int16Array</code> \| <code>Uint32Array</code> \| <code>Int32Array</code> \| <code>Float32Array</code> \| <code>Float64Array</code> \| <code>string</code> \| <code>Array</code> | | if present, can be a Buffer / ArrayBuffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image data, or a TypedArray containing raw pixel image data, or a String containing the filesystem path to an JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image file. An array of inputs can be provided, and these will be joined together. JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present. |
|
||||||
| [options] | <code>Object</code> | | if present, is an Object with optional attributes. |
|
| [options] | <code>Object</code> | | if present, is an Object with optional attributes. |
|
||||||
| [options.failOn] | <code>string</code> | <code>"'warning'"</code> | when to abort processing of invalid pixel data, one of (in order of sensitivity): 'none' (least), 'truncated', 'error' or 'warning' (most), higher levels imply lower levels, invalid metadata will always abort. |
|
| [options.failOn] | <code>string</code> | <code>"'warning'"</code> | When to abort processing of invalid pixel data, one of (in order of sensitivity, least to most): 'none', 'truncated', 'error', 'warning'. Higher levels imply lower levels. Invalid metadata will always abort. |
|
||||||
| [options.limitInputPixels] | <code>number</code> \| <code>boolean</code> | <code>268402689</code> | Do not process input images where the number of pixels (width x height) exceeds this limit. Assumes image dimensions contained in the input metadata can be trusted. An integral Number of pixels, zero or false to remove limit, true to use default limit of 268402689 (0x3FFF x 0x3FFF). |
|
| [options.limitInputPixels] | <code>number</code> \| <code>boolean</code> | <code>268402689</code> | Do not process input images where the number of pixels (width x height) exceeds this limit. Assumes image dimensions contained in the input metadata can be trusted. An integral Number of pixels, zero or false to remove limit, true to use default limit of 268402689 (0x3FFF x 0x3FFF). |
|
||||||
| [options.unlimited] | <code>boolean</code> | <code>false</code> | Set this to `true` to remove safety features that help prevent memory exhaustion (JPEG, PNG, SVG, HEIF). |
|
| [options.unlimited] | <code>boolean</code> | <code>false</code> | Set this to `true` to remove safety features that help prevent memory exhaustion (JPEG, PNG, SVG, HEIF). |
|
||||||
|
| [options.autoOrient] | <code>boolean</code> | <code>false</code> | Set this to `true` to rotate/flip the image to match EXIF `Orientation`, if any. |
|
||||||
| [options.sequentialRead] | <code>boolean</code> | <code>true</code> | Set this to `false` to use random access rather than sequential read. Some operations will do this automatically. |
|
| [options.sequentialRead] | <code>boolean</code> | <code>true</code> | Set this to `false` to use random access rather than sequential read. Some operations will do this automatically. |
|
||||||
| [options.density] | <code>number</code> | <code>72</code> | number representing the DPI for vector images in the range 1 to 100000. |
|
| [options.density] | <code>number</code> | <code>72</code> | number representing the DPI for vector images in the range 1 to 100000. |
|
||||||
| [options.ignoreIcc] | <code>number</code> | <code>false</code> | should the embedded ICC profile, if any, be ignored. |
|
| [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.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.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.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.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] | <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.width] | <code>number</code> | | integral number of pixels wide. |
|
||||||
| [options.raw.height] | <code>number</code> | | integral number of pixels high. |
|
| [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.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.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] | <code>Object</code> | | describes a new image to be created. |
|
||||||
| [options.create.width] | <code>number</code> | | integral number of pixels wide. |
|
| [options.create.width] | <code>number</code> | | integral number of pixels wide. |
|
||||||
| [options.create.height] | <code>number</code> | | integral number of pixels high. |
|
| [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.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.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] | <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.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.mean] | <code>number</code> | <code>128</code> | Mean value of pixels in the generated noise. |
|
||||||
| [options.create.noise.sigma] | <code>number</code> | | standard deviation of pixels in 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] | <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.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. |
|
| [options.text.font] | <code>string</code> | | font name to render with. |
|
||||||
@ -62,7 +72,25 @@ Implements the [stream.Duplex](http://nodejs.org/api/stream.html#stream_class_st
|
|||||||
| [options.text.dpi] | <code>number</code> | <code>72</code> | the resolution (size) at which to render the text. Does not take effect if `height` is specified. |
|
| [options.text.dpi] | <code>number</code> | <code>72</code> | the resolution (size) at which to render the text. Does not take effect if `height` is specified. |
|
||||||
| [options.text.rgba] | <code>boolean</code> | <code>false</code> | set this to true to enable RGBA output. This is useful for colour emoji rendering, or support for pango markup features like `<span foreground="red">Red!</span>`. |
|
| [options.text.rgba] | <code>boolean</code> | <code>false</code> | set this to true to enable RGBA output. This is useful for colour emoji rendering, or support for pango markup features like `<span foreground="red">Red!</span>`. |
|
||||||
| [options.text.spacing] | <code>number</code> | <code>0</code> | text line height in points. Will use the font line height if none is specified. |
|
| [options.text.spacing] | <code>number</code> | <code>0</code> | text line height in points. Will use the font line height if none is specified. |
|
||||||
| [options.text.wrap] | <code>string</code> | <code>"'word'"</code> | word wrapping style when width is provided, one of: 'word', 'char', 'charWord' (prefer char, fallback to word) or 'none'. |
|
| [options.text.wrap] | <code>string</code> | <code>"'word'"</code> | word wrapping style when width is provided, one of: 'word', 'char', 'word-char' (prefer word, fallback to char) or 'none'. |
|
||||||
|
| [options.join] | <code>Object</code> | | describes how an array of input images should be joined. |
|
||||||
|
| [options.join.across] | <code>number</code> | <code>1</code> | number of images to join horizontally. |
|
||||||
|
| [options.join.animated] | <code>boolean</code> | <code>false</code> | set this to `true` to join the images as an animated image. |
|
||||||
|
| [options.join.shim] | <code>number</code> | <code>0</code> | number of pixels to insert between joined images. |
|
||||||
|
| [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>"'left'"</code> | horizontal alignment style for images joined horizontally (`'left'`, `'centre'`, `'center'`, `'right'`). |
|
||||||
|
| [options.join.valign] | <code>string</code> | <code>"'top'"</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**
|
**Example**
|
||||||
```js
|
```js
|
||||||
@ -75,14 +103,16 @@ sharp('input.jpg')
|
|||||||
```
|
```
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
// Read image data from readableStream,
|
// Read image data from remote URL,
|
||||||
// resize to 300 pixels wide,
|
// resize to 300 pixels wide,
|
||||||
// emit an 'info' event with calculated dimensions
|
// emit an 'info' event with calculated dimensions
|
||||||
// and finally write image data to writableStream
|
// and finally write image data to writableStream
|
||||||
var transformer = sharp()
|
const { body } = fetch('https://...');
|
||||||
|
const readableStream = Readable.fromWeb(body);
|
||||||
|
const transformer = sharp()
|
||||||
.resize(300)
|
.resize(300)
|
||||||
.on('info', function(info) {
|
.on('info', ({ height }) => {
|
||||||
console.log('Image height is ' + info.height);
|
console.log(`Image height is ${height}`);
|
||||||
});
|
});
|
||||||
readableStream.pipe(transformer).pipe(writableStream);
|
readableStream.pipe(transformer).pipe(writableStream);
|
||||||
```
|
```
|
||||||
@ -160,6 +190,22 @@ await sharp({
|
|||||||
}
|
}
|
||||||
}).toFile('text_rgba.png');
|
}).toFile('text_rgba.png');
|
||||||
```
|
```
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
// Join four input images as a 2x2 grid with a 4 pixel gutter
|
||||||
|
const data = await sharp(
|
||||||
|
[image1, image2, image3, image4],
|
||||||
|
{ join: { across: 2, shim: 4 } }
|
||||||
|
).toBuffer();
|
||||||
|
```
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
// Generate a two-frame animated image from emoji
|
||||||
|
const images = ['😀', '😛'].map(text => ({
|
||||||
|
text: { text, width: 64, height: 64, channels: 4, rgba: true }
|
||||||
|
}));
|
||||||
|
await sharp(images, { join: { animated: true } }).toFile('out.gif');
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## clone
|
## clone
|
@ -1,3 +1,8 @@
|
|||||||
|
---
|
||||||
|
# This file was auto-generated from JSDoc in lib/input.js
|
||||||
|
title: Input metadata
|
||||||
|
---
|
||||||
|
|
||||||
## metadata
|
## metadata
|
||||||
> metadata([callback]) ⇒ <code>Promise.<Object></code> \| <code>Sharp</code>
|
> metadata([callback]) ⇒ <code>Promise.<Object></code> \| <code>Sharp</code>
|
||||||
|
|
||||||
@ -22,15 +27,16 @@ A `Promise` is returned when `callback` is not provided.
|
|||||||
- `density`: Number of pixels per inch (DPI), if present
|
- `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
|
- `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
|
- `isProgressive`: Boolean indicating whether the image is interlaced using a progressive scan
|
||||||
|
- `isPalette`: Boolean indicating whether the image is palette-based (GIF, PNG).
|
||||||
|
- `bitsPerSample`: Number of bits per sample for each channel (GIF, PNG, HEIF).
|
||||||
- `pages`: Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP
|
- `pages`: Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP
|
||||||
- `pageHeight`: Number of pixels high each page in a multi-page image will be.
|
- `pageHeight`: Number of pixels high each page in a multi-page image will be.
|
||||||
- `paletteBitDepth`: Bit depth of palette-based image (GIF, PNG).
|
|
||||||
- `loop`: Number of times to loop an animated image, zero refers to a continuous loop.
|
- `loop`: Number of times to loop an animated image, zero refers to a continuous loop.
|
||||||
- `delay`: Delay in ms between each page in an animated image, provided as an array of integers.
|
- `delay`: Delay in ms between each page in an animated image, provided as an array of integers.
|
||||||
- `pagePrimary`: Number of the primary page in a HEIF image
|
- `pagePrimary`: Number of the primary page in a HEIF image
|
||||||
- `levels`: Details of each level in a multi-level image provided as an array of objects, requires libvips compiled with support for OpenSlide
|
- `levels`: Details of each level in a multi-level image provided as an array of objects, requires libvips compiled with support for OpenSlide
|
||||||
- `subifds`: Number of Sub Image File Directories in an OME-TIFF image
|
- `subifds`: Number of Sub Image File Directories in an OME-TIFF image
|
||||||
- `background`: Default background colour, if present, for PNG (bKGD) and GIF images, either an RGB Object or a single greyscale value
|
- `background`: Default background colour, if present, for PNG (bKGD) and GIF images
|
||||||
- `compression`: The encoder used to compress an HEIF file, `av1` (AVIF) or `hevc` (HEIC)
|
- `compression`: The encoder used to compress an HEIF file, `av1` (AVIF) or `hevc` (HEIC)
|
||||||
- `resolutionUnit`: The unit of resolution (density), either `inch` or `cm`, if present
|
- `resolutionUnit`: The unit of resolution (density), either `inch` or `cm`, if present
|
||||||
- `hasProfile`: Boolean indicating the presence of an embedded ICC profile
|
- `hasProfile`: Boolean indicating the presence of an embedded ICC profile
|
||||||
@ -40,8 +46,10 @@ A `Promise` is returned when `callback` is not provided.
|
|||||||
- `icc`: Buffer containing raw [ICC](https://www.npmjs.com/package/icc) profile data, if present
|
- `icc`: Buffer containing raw [ICC](https://www.npmjs.com/package/icc) profile data, if present
|
||||||
- `iptc`: Buffer containing raw IPTC data, if present
|
- `iptc`: Buffer containing raw IPTC data, if present
|
||||||
- `xmp`: Buffer containing raw XMP 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
|
- `tifftagPhotoshop`: Buffer containing raw TIFFTAG_PHOTOSHOP data, if present
|
||||||
- `formatMagick`: String containing format for images loaded via *magick
|
- `formatMagick`: String containing format for images loaded via *magick
|
||||||
|
- `comments`: Array of keyword/text pairs representing PNG text blocks, if present.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -70,15 +78,9 @@ image
|
|||||||
```
|
```
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
// Based on EXIF rotation metadata, get the right-side-up width and height:
|
// Get dimensions taking EXIF Orientation into account.
|
||||||
|
const { autoOrient } = await sharp(input).metadata();
|
||||||
const size = getNormalSize(await sharp(input).metadata());
|
const { width, height } = autoOrient;
|
||||||
|
|
||||||
function getNormalSize({ width, height, orientation }) {
|
|
||||||
return (orientation || 0) >= 5
|
|
||||||
? { width: height, height: width }
|
|
||||||
: { width, height };
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1,22 +1,26 @@
|
|||||||
|
---
|
||||||
|
# This file was auto-generated from JSDoc in lib/operation.js
|
||||||
|
title: Image operations
|
||||||
|
---
|
||||||
|
|
||||||
## rotate
|
## rotate
|
||||||
> rotate([angle], [options]) ⇒ <code>Sharp</code>
|
> rotate([angle], [options]) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
Rotate the output image by either an explicit angle
|
Rotate the output image.
|
||||||
or auto-orient based on the EXIF `Orientation` tag.
|
|
||||||
|
|
||||||
If an angle is provided, it is converted to a valid positive degree rotation.
|
The provided angle is converted to a valid positive degree rotation.
|
||||||
For example, `-450` will produce a 270 degree rotation.
|
For example, `-450` will produce a 270 degree rotation.
|
||||||
|
|
||||||
When rotating by an angle other than a multiple of 90,
|
When rotating by an angle other than a multiple of 90,
|
||||||
the background colour can be provided with the `background` option.
|
the background colour can be provided with the `background` option.
|
||||||
|
|
||||||
If no angle is provided, it is determined from the EXIF data.
|
For backwards compatibility, if no angle is provided, `.autoOrient()` will be called.
|
||||||
Mirroring is supported and may infer the use of a flip operation.
|
|
||||||
|
|
||||||
The use of `rotate` without an angle will remove the EXIF `Orientation` tag, if any.
|
Only one rotation can occur per pipeline (aside from an initial call without
|
||||||
|
arguments to orient via EXIF data). Previous calls to `rotate` in the same
|
||||||
|
pipeline will be ignored.
|
||||||
|
|
||||||
Only one rotation can occur per pipeline.
|
Multi-page images can only be rotated by 180 degrees.
|
||||||
Previous calls to `rotate` in the same pipeline will be ignored.
|
|
||||||
|
|
||||||
Method order is important when rotating, resizing and/or extracting regions,
|
Method order is important when rotating, resizing and/or extracting regions,
|
||||||
for example `.rotate(x).extract(y)` will produce a different result to `.extract(y).rotate(x)`.
|
for example `.rotate(x).extract(y)` will produce a different result to `.extract(y).rotate(x)`.
|
||||||
@ -33,18 +37,6 @@ for example `.rotate(x).extract(y)` will produce a different result to `.extract
|
|||||||
| [options] | <code>Object</code> | | if present, is an Object with optional attributes. |
|
| [options] | <code>Object</code> | | if present, is an Object with optional attributes. |
|
||||||
| [options.background] | <code>string</code> \| <code>Object</code> | <code>"\"#000000\""</code> | parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
|
| [options.background] | <code>string</code> \| <code>Object</code> | <code>"\"#000000\""</code> | parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
|
||||||
|
|
||||||
**Example**
|
|
||||||
```js
|
|
||||||
const pipeline = sharp()
|
|
||||||
.rotate()
|
|
||||||
.resize(null, 200)
|
|
||||||
.toBuffer(function (err, outputBuffer, info) {
|
|
||||||
// outputBuffer contains 200px high JPEG image data,
|
|
||||||
// auto-rotated using EXIF Orientation tag
|
|
||||||
// info.width and info.height contain the dimensions of the resized image
|
|
||||||
});
|
|
||||||
readableStream.pipe(pipeline);
|
|
||||||
```
|
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
const rotateThenResize = await sharp(input)
|
const rotateThenResize = await sharp(input)
|
||||||
@ -58,6 +50,34 @@ const resizeThenRotate = await sharp(input)
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## autoOrient
|
||||||
|
> autoOrient() ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
|
Auto-orient based on the EXIF `Orientation` tag, then remove the tag.
|
||||||
|
Mirroring is supported and may infer the use of a flip operation.
|
||||||
|
|
||||||
|
Previous or subsequent use of `rotate(angle)` and either `flip()` or `flop()`
|
||||||
|
will logically occur after auto-orientation, regardless of call order.
|
||||||
|
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
const output = await sharp(input).autoOrient().toBuffer();
|
||||||
|
```
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
const pipeline = sharp()
|
||||||
|
.autoOrient()
|
||||||
|
.resize(null, 200)
|
||||||
|
.toBuffer(function (err, outputBuffer, info) {
|
||||||
|
// outputBuffer contains 200px high JPEG image data,
|
||||||
|
// auto-oriented using EXIF Orientation tag
|
||||||
|
// info.width and info.height contain the dimensions of the resized image
|
||||||
|
});
|
||||||
|
readableStream.pipe(pipeline);
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## flip
|
## flip
|
||||||
> flip([flip]) ⇒ <code>Sharp</code>
|
> flip([flip]) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
@ -102,7 +122,7 @@ const output = await sharp(input).flop().toBuffer();
|
|||||||
Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
|
Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
|
||||||
|
|
||||||
You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
||||||
By default, new pixels are filled with a black background. You can provide a background color with the `background` option.
|
By default, new pixels are filled with a black background. You can provide a background colour with the `background` option.
|
||||||
A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
||||||
|
|
||||||
In the case of a 2x2 matrix, the transform is:
|
In the case of a 2x2 matrix, the transform is:
|
||||||
@ -229,7 +249,7 @@ const output = await sharp(input).median(5).toBuffer();
|
|||||||
|
|
||||||
|
|
||||||
## blur
|
## blur
|
||||||
> blur([sigma]) ⇒ <code>Sharp</code>
|
> blur([options]) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
Blur the image.
|
Blur the image.
|
||||||
|
|
||||||
@ -243,9 +263,12 @@ When a `sigma` is provided, performs a slower, more accurate Gaussian blur.
|
|||||||
- <code>Error</code> Invalid parameters
|
- <code>Error</code> Invalid parameters
|
||||||
|
|
||||||
|
|
||||||
| Param | Type | Description |
|
| Param | Type | Default | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| [sigma] | <code>number</code> | a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`. |
|
| [options] | <code>Object</code> \| <code>number</code> \| <code>Boolean</code> | | |
|
||||||
|
| [options.sigma] | <code>number</code> | | a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`. |
|
||||||
|
| [options.precision] | <code>string</code> | <code>"'integer'"</code> | How accurate the operation should be, one of: integer, float, approximate. |
|
||||||
|
| [options.minAmplitude] | <code>number</code> | <code>0.2</code> | A value between 0.001 and 1. A smaller value will generate a larger, more accurate mask. |
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
@ -261,6 +284,52 @@ const gaussianBlurred = await sharp(input)
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## dilate
|
||||||
|
> dilate([width]) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
|
Expand foreground objects using the dilate morphological operator.
|
||||||
|
|
||||||
|
|
||||||
|
**Throws**:
|
||||||
|
|
||||||
|
- <code>Error</code> Invalid parameters
|
||||||
|
|
||||||
|
|
||||||
|
| Param | Type | Default | Description |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| [width] | <code>Number</code> | <code>1</code> | dilation width in pixels. |
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
const output = await sharp(input)
|
||||||
|
.dilate()
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## erode
|
||||||
|
> erode([width]) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
|
Shrink foreground objects using the erode morphological operator.
|
||||||
|
|
||||||
|
|
||||||
|
**Throws**:
|
||||||
|
|
||||||
|
- <code>Error</code> Invalid parameters
|
||||||
|
|
||||||
|
|
||||||
|
| Param | Type | Default | Description |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| [width] | <code>Number</code> | <code>1</code> | erosion width in pixels. |
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
const output = await sharp(input)
|
||||||
|
.erode()
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## flatten
|
## flatten
|
||||||
> flatten([options]) ⇒ <code>Sharp</code>
|
> flatten([options]) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
@ -578,7 +647,7 @@ Recombine the image with the specified matrix.
|
|||||||
|
|
||||||
| Param | Type | Description |
|
| Param | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| inputMatrix | <code>Array.<Array.<number>></code> | 3x3 Recombination matrix |
|
| inputMatrix | <code>Array.<Array.<number>></code> | 3x3 or 4x4 Recombination matrix |
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
@ -1,3 +1,8 @@
|
|||||||
|
---
|
||||||
|
# This file was auto-generated from JSDoc in lib/output.js
|
||||||
|
title: Output options
|
||||||
|
---
|
||||||
|
|
||||||
## toFile
|
## toFile
|
||||||
> toFile(fileOut, [callback]) ⇒ <code>Promise.<Object></code>
|
> toFile(fileOut, [callback]) ⇒ <code>Promise.<Object></code>
|
||||||
|
|
||||||
@ -24,7 +29,7 @@ A `Promise` is returned when `callback` is not provided.
|
|||||||
| Param | Type | Description |
|
| Param | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| fileOut | <code>string</code> | the path to write the image data to. |
|
| fileOut | <code>string</code> | the path to write the image data to. |
|
||||||
| [callback] | <code>function</code> | called on completion with two arguments `(err, info)`. `info` contains the output image `format`, `size` (bytes), `width`, `height`, `channels` and `premultiplied` (indicating if premultiplication was used). When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`. When using the attention crop strategy also contains `attentionX` and `attentionY`, the focal point of the cropped region. May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text. |
|
| [callback] | <code>function</code> | called on completion with two arguments `(err, info)`. `info` contains the output image `format`, `size` (bytes), `width`, `height`, `channels` and `premultiplied` (indicating if premultiplication was used). When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`. When using the attention crop strategy also contains `attentionX` and `attentionY`, the focal point of the cropped region. Animated output will also contain `pageHeight` and `pages`. May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text. |
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
@ -59,6 +64,7 @@ See [withMetadata](#withmetadata) for control over this.
|
|||||||
- `info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
- `info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
||||||
`channels` and `premultiplied` (indicating if premultiplication was used).
|
`channels` and `premultiplied` (indicating if premultiplication was used).
|
||||||
When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
|
When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
|
||||||
|
Animated output will also contain `pageHeight` and `pages`.
|
||||||
May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
|
May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
|
||||||
|
|
||||||
A `Promise` is returned when `callback` is not provided.
|
A `Promise` is returned when `callback` is not provided.
|
||||||
@ -111,17 +117,208 @@ await sharp(pixelArray, { raw: { width, height, channels } })
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## keepExif
|
||||||
|
> keepExif() ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
|
Keep all EXIF metadata from the input image in the output image.
|
||||||
|
|
||||||
|
EXIF metadata is unsupported for TIFF output.
|
||||||
|
|
||||||
|
|
||||||
|
**Since**: 0.33.0
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
const outputWithExif = await sharp(inputWithExif)
|
||||||
|
.keepExif()
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## withExif
|
||||||
|
> withExif(exif) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
|
Set EXIF metadata in the output image, ignoring any EXIF in the input image.
|
||||||
|
|
||||||
|
|
||||||
|
**Throws**:
|
||||||
|
|
||||||
|
- <code>Error</code> Invalid parameters
|
||||||
|
|
||||||
|
**Since**: 0.33.0
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| exif | <code>Object.<string, Object.<string, string>></code> | Object keyed by IFD0, IFD1 etc. of key/value string pairs to write as EXIF data. |
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
const dataWithExif = await sharp(input)
|
||||||
|
.withExif({
|
||||||
|
IFD0: {
|
||||||
|
Copyright: 'The National Gallery'
|
||||||
|
},
|
||||||
|
IFD3: {
|
||||||
|
GPSLatitudeRef: 'N',
|
||||||
|
GPSLatitude: '51/1 30/1 3230/100',
|
||||||
|
GPSLongitudeRef: 'W',
|
||||||
|
GPSLongitude: '0/1 7/1 4366/100'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## withExifMerge
|
||||||
|
> withExifMerge(exif) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
|
Update EXIF metadata from the input image in the output image.
|
||||||
|
|
||||||
|
|
||||||
|
**Throws**:
|
||||||
|
|
||||||
|
- <code>Error</code> Invalid parameters
|
||||||
|
|
||||||
|
**Since**: 0.33.0
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| exif | <code>Object.<string, Object.<string, string>></code> | Object keyed by IFD0, IFD1 etc. of key/value string pairs to write as EXIF data. |
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
const dataWithMergedExif = await sharp(inputWithExif)
|
||||||
|
.withExifMerge({
|
||||||
|
IFD0: {
|
||||||
|
Copyright: 'The National Gallery'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## keepIccProfile
|
||||||
|
> keepIccProfile() ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
**Since**: 0.33.0
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
const outputWithIccProfile = await sharp(inputWithIccProfile)
|
||||||
|
.keepIccProfile()
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## withIccProfile
|
||||||
|
> withIccProfile(icc, [options]) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
|
Transform using an ICC profile and attach to the output image.
|
||||||
|
|
||||||
|
This can either be an absolute filesystem path or
|
||||||
|
built-in profile name (`srgb`, `p3`, `cmyk`).
|
||||||
|
|
||||||
|
|
||||||
|
**Throws**:
|
||||||
|
|
||||||
|
- <code>Error</code> Invalid parameters
|
||||||
|
|
||||||
|
**Since**: 0.33.0
|
||||||
|
|
||||||
|
| Param | Type | Default | Description |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| icc | <code>string</code> | | Absolute filesystem path to output ICC profile or built-in profile name (srgb, p3, cmyk). |
|
||||||
|
| [options] | <code>Object</code> | | |
|
||||||
|
| [options.attach] | <code>number</code> | <code>true</code> | Should the ICC profile be included in the output image metadata? |
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
const outputWithP3 = await sharp(input)
|
||||||
|
.withIccProfile('p3')
|
||||||
|
.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>
|
||||||
|
|
||||||
|
Keep all metadata (EXIF, ICC, XMP, IPTC) from the input image in the output image.
|
||||||
|
|
||||||
|
The default behaviour, when `keepMetadata` is not used, is to convert to the device-independent
|
||||||
|
sRGB colour space and strip all metadata, including the removal of any ICC profile.
|
||||||
|
|
||||||
|
|
||||||
|
**Since**: 0.33.0
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
const outputWithMetadata = await sharp(inputWithMetadata)
|
||||||
|
.keepMetadata()
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## withMetadata
|
## withMetadata
|
||||||
> withMetadata([options]) ⇒ <code>Sharp</code>
|
> withMetadata([options]) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
Include all metadata (EXIF, XMP, IPTC) from the input image in the output image.
|
Keep most metadata (EXIF, XMP, IPTC) from the input image in the output image.
|
||||||
This will also convert to and add a web-friendly sRGB ICC profile if appropriate,
|
|
||||||
unless a custom output profile is provided.
|
|
||||||
|
|
||||||
The default behaviour, when `withMetadata` is not used, is to convert to the device-independent
|
This will also convert to and add a web-friendly sRGB ICC profile if appropriate.
|
||||||
sRGB colour space and strip all metadata, including the removal of any ICC profile.
|
|
||||||
|
|
||||||
EXIF metadata is unsupported for TIFF output.
|
Allows orientation and density to be set or updated.
|
||||||
|
|
||||||
|
|
||||||
**Throws**:
|
**Throws**:
|
||||||
@ -129,38 +326,16 @@ EXIF metadata is unsupported for TIFF output.
|
|||||||
- <code>Error</code> Invalid parameters
|
- <code>Error</code> Invalid parameters
|
||||||
|
|
||||||
|
|
||||||
| Param | Type | Default | Description |
|
| Param | Type | Description |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [options] | <code>Object</code> | | |
|
| [options] | <code>Object</code> | |
|
||||||
| [options.orientation] | <code>number</code> | | value between 1 and 8, used to update the EXIF `Orientation` tag. |
|
| [options.orientation] | <code>number</code> | Used to update the EXIF `Orientation` tag, integer between 1 and 8. |
|
||||||
| [options.icc] | <code>string</code> | <code>"'srgb'"</code> | Filesystem path to output ICC profile, relative to `process.cwd()`, defaults to built-in sRGB. |
|
| [options.density] | <code>number</code> | Number of pixels per inch (DPI). |
|
||||||
| [options.exif] | <code>Object.<Object></code> | <code>{}</code> | Object keyed by IFD0, IFD1 etc. of key/value string pairs to write as EXIF data. |
|
|
||||||
| [options.density] | <code>number</code> | | Number of pixels per inch (DPI). |
|
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
sharp('input.jpg')
|
const outputSrgbWithMetadata = await sharp(inputRgbWithMetadata)
|
||||||
.withMetadata()
|
.withMetadata()
|
||||||
.toFile('output-with-metadata.jpg')
|
|
||||||
.then(info => { ... });
|
|
||||||
```
|
|
||||||
**Example**
|
|
||||||
```js
|
|
||||||
// Set output EXIF metadata
|
|
||||||
const data = await sharp(input)
|
|
||||||
.withMetadata({
|
|
||||||
exif: {
|
|
||||||
IFD0: {
|
|
||||||
Copyright: 'The National Gallery'
|
|
||||||
},
|
|
||||||
IFD3: {
|
|
||||||
GPSLatitudeRef: 'N',
|
|
||||||
GPSLatitude: '51/1 30/1 3230/100',
|
|
||||||
GPSLongitudeRef: 'W',
|
|
||||||
GPSLongitude: '0/1 7/1 4366/100'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.toBuffer();
|
.toBuffer();
|
||||||
```
|
```
|
||||||
**Example**
|
**Example**
|
||||||
@ -249,10 +424,14 @@ const data = await sharp(input)
|
|||||||
|
|
||||||
Use these PNG options for output image.
|
Use these PNG options for output image.
|
||||||
|
|
||||||
By default, PNG output is full colour at 8 or 16 bits per pixel.
|
By default, PNG output is full colour at 8 bits per pixel.
|
||||||
|
|
||||||
Indexed PNG input at 1, 2 or 4 bits per pixel is converted to 8 bits per pixel.
|
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.
|
Set `palette` to `true` for slower, indexed PNG output.
|
||||||
|
|
||||||
|
For 16 bits per pixel output, convert to `rgb16` via
|
||||||
|
[toColourspace](/api-colour#tocolourspace).
|
||||||
|
|
||||||
|
|
||||||
**Throws**:
|
**Throws**:
|
||||||
|
|
||||||
@ -287,6 +466,14 @@ const data = await sharp(input)
|
|||||||
.png({ palette: true })
|
.png({ palette: true })
|
||||||
.toBuffer();
|
.toBuffer();
|
||||||
```
|
```
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
// Output 16 bits per pixel RGB(A)
|
||||||
|
const data = await sharp(input)
|
||||||
|
.toColourspace('rgb16')
|
||||||
|
.png()
|
||||||
|
.toBuffer();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## webp
|
## webp
|
||||||
@ -308,6 +495,7 @@ Use these WebP options for output image.
|
|||||||
| [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression mode |
|
| [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression mode |
|
||||||
| [options.nearLossless] | <code>boolean</code> | <code>false</code> | use near_lossless compression mode |
|
| [options.nearLossless] | <code>boolean</code> | <code>false</code> | use near_lossless compression mode |
|
||||||
| [options.smartSubsample] | <code>boolean</code> | <code>false</code> | use high quality chroma subsampling |
|
| [options.smartSubsample] | <code>boolean</code> | <code>false</code> | use high quality chroma subsampling |
|
||||||
|
| [options.smartDeblock] | <code>boolean</code> | <code>false</code> | auto-adjust the deblocking filter, can improve low contrast edges (slow) |
|
||||||
| [options.preset] | <code>string</code> | <code>"'default'"</code> | named preset for preprocessing/filtering, one of: default, photo, picture, drawing, icon, text |
|
| [options.preset] | <code>string</code> | <code>"'default'"</code> | named preset for preprocessing/filtering, one of: default, photo, picture, drawing, icon, text |
|
||||||
| [options.effort] | <code>number</code> | <code>4</code> | CPU effort, between 0 (fastest) and 6 (slowest) |
|
| [options.effort] | <code>number</code> | <code>4</code> | CPU effort, between 0 (fastest) and 6 (slowest) |
|
||||||
| [options.loop] | <code>number</code> | <code>0</code> | number of animation iterations, use 0 for infinite animation |
|
| [options.loop] | <code>number</code> | <code>0</code> | number of animation iterations, use 0 for infinite animation |
|
||||||
@ -359,6 +547,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.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.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.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.loop] | <code>number</code> | <code>0</code> | number of animation iterations, use 0 for infinite animation |
|
||||||
| [options.delay] | <code>number</code> \| <code>Array.<number></code> | | delay(s) between animation frames (in milliseconds) |
|
| [options.delay] | <code>number</code> \| <code>Array.<number></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 |
|
| [options.force] | <code>boolean</code> | <code>true</code> | force GIF output, otherwise attempt to use input format |
|
||||||
@ -466,6 +655,7 @@ instead of providing `xres` and `yres` in pixels/mm.
|
|||||||
| [options.yres] | <code>number</code> | <code>1.0</code> | vertical resolution in pixels/mm |
|
| [options.yres] | <code>number</code> | <code>1.0</code> | vertical resolution in pixels/mm |
|
||||||
| [options.resolutionUnit] | <code>string</code> | <code>"'inch'"</code> | resolution unit options: inch, cm |
|
| [options.resolutionUnit] | <code>string</code> | <code>"'inch'"</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>8</code> | reduce bitdepth to 1, 2 or 4 bit |
|
||||||
|
| [options.miniswhite] | <code>boolean</code> | <code>false</code> | write 1-bit images as miniswhite |
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
@ -486,6 +676,10 @@ sharp('input.svg')
|
|||||||
Use these AVIF options for output image.
|
Use these AVIF options for output image.
|
||||||
|
|
||||||
AVIF image sequences are not supported.
|
AVIF image sequences are not supported.
|
||||||
|
Prebuilt binaries support a bitdepth of 8 only.
|
||||||
|
|
||||||
|
This feature is experimental on the Windows ARM64 platform
|
||||||
|
and requires a CPU with ARM64v8.4 or later.
|
||||||
|
|
||||||
|
|
||||||
**Throws**:
|
**Throws**:
|
||||||
@ -501,6 +695,7 @@ AVIF image sequences are not supported.
|
|||||||
| [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression |
|
| [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression |
|
||||||
| [options.effort] | <code>number</code> | <code>4</code> | CPU effort, between 0 (fastest) and 9 (slowest) |
|
| [options.effort] | <code>number</code> | <code>4</code> | CPU effort, between 0 (fastest) and 9 (slowest) |
|
||||||
| [options.chromaSubsampling] | <code>string</code> | <code>"'4:4:4'"</code> | set to '4:2:0' to use chroma subsampling |
|
| [options.chromaSubsampling] | <code>string</code> | <code>"'4:4:4'"</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 |
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
@ -539,6 +734,7 @@ globally-installed libvips compiled with support for libheif, libde265 and x265.
|
|||||||
| [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression |
|
| [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression |
|
||||||
| [options.effort] | <code>number</code> | <code>4</code> | CPU effort, between 0 (fastest) and 9 (slowest) |
|
| [options.effort] | <code>number</code> | <code>4</code> | CPU effort, between 0 (fastest) and 9 (slowest) |
|
||||||
| [options.chromaSubsampling] | <code>string</code> | <code>"'4:4:4'"</code> | set to '4:2:0' to use chroma subsampling |
|
| [options.chromaSubsampling] | <code>string</code> | <code>"'4:4:4'"</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 |
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
@ -559,8 +755,6 @@ Requires libvips compiled with support for libjxl.
|
|||||||
The prebuilt binaries do not include this - see
|
The prebuilt binaries do not include this - see
|
||||||
[installing a custom libvips](https://sharp.pixelplumbing.com/install#custom-libvips).
|
[installing a custom libvips](https://sharp.pixelplumbing.com/install#custom-libvips).
|
||||||
|
|
||||||
Image metadata (EXIF, XMP) is unsupported.
|
|
||||||
|
|
||||||
|
|
||||||
**Throws**:
|
**Throws**:
|
||||||
|
|
||||||
@ -575,7 +769,9 @@ Image metadata (EXIF, XMP) is unsupported.
|
|||||||
| [options.quality] | <code>number</code> | | calculate `distance` based on JPEG-like quality, between 1 and 100, overrides distance if specified |
|
| [options.quality] | <code>number</code> | | calculate `distance` based on JPEG-like quality, between 1 and 100, overrides distance if specified |
|
||||||
| [options.decodingTier] | <code>number</code> | <code>0</code> | target decode speed tier, between 0 (highest quality) and 4 (lowest quality) |
|
| [options.decodingTier] | <code>number</code> | <code>0</code> | target decode speed tier, between 0 (highest quality) and 4 (lowest quality) |
|
||||||
| [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression |
|
| [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression |
|
||||||
| [options.effort] | <code>number</code> | <code>7</code> | CPU effort, between 3 (fastest) and 9 (slowest) |
|
| [options.effort] | <code>number</code> | <code>7</code> | CPU effort, between 1 (fastest) and 9 (slowest) |
|
||||||
|
| [options.loop] | <code>number</code> | <code>0</code> | number of animation iterations, use 0 for infinite animation |
|
||||||
|
| [options.delay] | <code>number</code> \| <code>Array.<number></code> | | delay(s) between animation frames (in milliseconds) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -626,10 +822,6 @@ Use a `.zip` or `.szi` file extension with `toFile` to write to a compressed arc
|
|||||||
|
|
||||||
The container will be set to `zip` when the output is a Buffer or Stream, otherwise it will default to `fs`.
|
The container will be set to `zip` when the output is a Buffer or Stream, otherwise it will default to `fs`.
|
||||||
|
|
||||||
Requires libvips compiled with support for libgsf.
|
|
||||||
The prebuilt binaries do not include this - see
|
|
||||||
[installing a custom libvips](https://sharp.pixelplumbing.com/install#custom-libvips).
|
|
||||||
|
|
||||||
|
|
||||||
**Throws**:
|
**Throws**:
|
||||||
|
|
||||||
@ -644,7 +836,7 @@ The prebuilt binaries do not include this - see
|
|||||||
| [options.angle] | <code>number</code> | <code>0</code> | tile angle of rotation, must be a multiple of 90. |
|
| [options.angle] | <code>number</code> | <code>0</code> | tile angle of rotation, must be a multiple of 90. |
|
||||||
| [options.background] | <code>string</code> \| <code>Object</code> | <code>"{r: 255, g: 255, b: 255, alpha: 1}"</code> | background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to white without transparency. |
|
| [options.background] | <code>string</code> \| <code>Object</code> | <code>"{r: 255, g: 255, b: 255, alpha: 1}"</code> | background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to white without transparency. |
|
||||||
| [options.depth] | <code>string</code> | | how deep to make the pyramid, possible values are `onepixel`, `onetile` or `one`, default based on layout. |
|
| [options.depth] | <code>string</code> | | how deep to make the pyramid, possible values are `onepixel`, `onetile` or `one`, default based on layout. |
|
||||||
| [options.skipBlanks] | <code>number</code> | <code>-1</code> | threshold to skip tile generation, a value 0 - 255 for 8-bit images or 0 - 65535 for 16-bit images |
|
| [options.skipBlanks] | <code>number</code> | <code>-1</code> | Threshold to skip tile generation. Range is 0-255 for 8-bit images, 0-65535 for 16-bit images. Default is 5 for `google` layout, -1 (no skip) otherwise. |
|
||||||
| [options.container] | <code>string</code> | <code>"'fs'"</code> | tile container, with value `fs` (filesystem) or `zip` (compressed file). |
|
| [options.container] | <code>string</code> | <code>"'fs'"</code> | tile container, with value `fs` (filesystem) or `zip` (compressed file). |
|
||||||
| [options.layout] | <code>string</code> | <code>"'dz'"</code> | filesystem layout, possible values are `dz`, `iiif`, `iiif3`, `zoomify` or `google`. |
|
| [options.layout] | <code>string</code> | <code>"'dz'"</code> | filesystem layout, possible values are `dz`, `iiif`, `iiif3`, `zoomify` or `google`. |
|
||||||
| [options.centre] | <code>boolean</code> | <code>false</code> | centre image in tile. |
|
| [options.centre] | <code>boolean</code> | <code>false</code> | centre image in tile. |
|
@ -1,3 +1,8 @@
|
|||||||
|
---
|
||||||
|
# This file was auto-generated from JSDoc in lib/resize.js
|
||||||
|
title: Resizing images
|
||||||
|
---
|
||||||
|
|
||||||
## resize
|
## resize
|
||||||
> resize([width], [height], [options]) ⇒ <code>Sharp</code>
|
> resize([width], [height], [options]) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
@ -12,7 +17,7 @@ When both a `width` and `height` are provided, the possible methods by which the
|
|||||||
|
|
||||||
Some of these values are based on the [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property.
|
Some of these values are based on the [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property.
|
||||||
|
|
||||||
<img alt="Examples of various values for the fit property when resizing" width="100%" style="aspect-ratio: 998/243" src="https://cdn.jsdelivr.net/gh/lovell/sharp@main/docs/image/api-resize-fit.svg">
|
<img alt="Examples of various values for the fit property when resizing" width="100%" style="aspect-ratio: 998/243" src="/api-resize-fit.svg">
|
||||||
|
|
||||||
When using a **fit** of `cover` or `contain`, the default **position** is `centre`. Other options are:
|
When using a **fit** of `cover` or `contain`, the default **position** is `centre`. Other options are:
|
||||||
- `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`.
|
- `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`.
|
||||||
@ -21,17 +26,23 @@ When using a **fit** of `cover` or `contain`, the default **position** is `centr
|
|||||||
|
|
||||||
Some of these values are based on the [object-position](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position) CSS property.
|
Some of these values are based on the [object-position](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position) CSS property.
|
||||||
|
|
||||||
The experimental strategy-based approach resizes so one dimension is at its target length
|
The strategy-based approach initially resizes so one dimension is at its target length
|
||||||
then repeatedly ranks edge regions, discarding the edge with the lowest score based on the selected strategy.
|
then repeatedly ranks edge regions, discarding the edge with the lowest score based on the selected strategy.
|
||||||
- `entropy`: focus on the region with the highest [Shannon entropy](https://en.wikipedia.org/wiki/Entropy_%28information_theory%29).
|
- `entropy`: focus on the region with the highest [Shannon entropy](https://en.wikipedia.org/wiki/Entropy_%28information_theory%29).
|
||||||
- `attention`: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.
|
- `attention`: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.
|
||||||
|
|
||||||
Possible interpolation kernels are:
|
Possible downsizing kernels are:
|
||||||
- `nearest`: Use [nearest neighbour interpolation](http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation).
|
- `nearest`: Use [nearest neighbour interpolation](http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation).
|
||||||
|
- `linear`: Use a [triangle filter](https://en.wikipedia.org/wiki/Triangular_function).
|
||||||
- `cubic`: Use a [Catmull-Rom spline](https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline).
|
- `cubic`: Use a [Catmull-Rom spline](https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline).
|
||||||
- `mitchell`: Use a [Mitchell-Netravali spline](https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf).
|
- `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`.
|
- `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).
|
- `lanczos3`: Use a Lanczos kernel with `a=3` (the default).
|
||||||
|
- `mks2013`: Use a [Magic Kernel Sharp](https://johncostella.com/magic/mks.pdf) 2013 kernel, as adopted by Facebook.
|
||||||
|
- `mks2021`: Use a Magic Kernel Sharp 2021 kernel, with more accurate (reduced) sharpening than the 2013 version.
|
||||||
|
|
||||||
|
When upsampling, these kernels map to `nearest`, `linear` and `cubic` interpolators.
|
||||||
|
Downsampling kernels without a matching upsampling interpolator map to `cubic`.
|
||||||
|
|
||||||
Only one resize can occur per pipeline.
|
Only one resize can occur per pipeline.
|
||||||
Previous calls to `resize` in the same pipeline will be ignored.
|
Previous calls to `resize` in the same pipeline will be ignored.
|
||||||
@ -52,7 +63,7 @@ Previous calls to `resize` in the same pipeline will be ignored.
|
|||||||
| [options.fit] | <code>String</code> | <code>'cover'</code> | How the image should be resized/cropped to fit the target dimension(s), one of `cover`, `contain`, `fill`, `inside` or `outside`. |
|
| [options.fit] | <code>String</code> | <code>'cover'</code> | How the image should be resized/cropped to fit the target dimension(s), one of `cover`, `contain`, `fill`, `inside` or `outside`. |
|
||||||
| [options.position] | <code>String</code> | <code>'centre'</code> | A position, gravity or strategy to use when `fit` is `cover` or `contain`. |
|
| [options.position] | <code>String</code> | <code>'centre'</code> | A position, gravity or strategy to use when `fit` is `cover` or `contain`. |
|
||||||
| [options.background] | <code>String</code> \| <code>Object</code> | <code>{r: 0, g: 0, b: 0, alpha: 1}</code> | background colour when `fit` is `contain`, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black without transparency. |
|
| [options.background] | <code>String</code> \| <code>Object</code> | <code>{r: 0, g: 0, b: 0, alpha: 1}</code> | background colour when `fit` is `contain`, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black without transparency. |
|
||||||
| [options.kernel] | <code>String</code> | <code>'lanczos3'</code> | The kernel to use for image reduction. Use the `fastShrinkOnLoad` option to control kernel vs shrink-on-load. |
|
| [options.kernel] | <code>String</code> | <code>'lanczos3'</code> | The kernel to use for image reduction and the inferred interpolator to use for upsampling. Use the `fastShrinkOnLoad` option to control kernel vs shrink-on-load. |
|
||||||
| [options.withoutEnlargement] | <code>Boolean</code> | <code>false</code> | Do not scale up if the width *or* height are already less than the target dimensions, equivalent to GraphicsMagick's `>` geometry option. This may result in output dimensions smaller than the target dimensions. |
|
| [options.withoutEnlargement] | <code>Boolean</code> | <code>false</code> | Do not scale up if the width *or* height are already less than the target dimensions, equivalent to GraphicsMagick's `>` geometry option. This may result in output dimensions smaller than the target dimensions. |
|
||||||
| [options.withoutReduction] | <code>Boolean</code> | <code>false</code> | Do not scale down if the width *or* height are already greater than the target dimensions, equivalent to GraphicsMagick's `<` geometry option. This may still result in a crop to reach the target dimensions. |
|
| [options.withoutReduction] | <code>Boolean</code> | <code>false</code> | Do not scale down if the width *or* height are already greater than the target dimensions, equivalent to GraphicsMagick's `<` geometry option. This may still result in a crop to reach the target dimensions. |
|
||||||
| [options.fastShrinkOnLoad] | <code>Boolean</code> | <code>true</code> | Take greater advantage of the JPEG and WebP shrink-on-load feature, which can lead to a slight moiré pattern or round-down of an auto-scaled dimension. |
|
| [options.fastShrinkOnLoad] | <code>Boolean</code> | <code>true</code> | Take greater advantage of the JPEG and WebP shrink-on-load feature, which can lead to a slight moiré pattern or round-down of an auto-scaled dimension. |
|
||||||
@ -251,7 +262,7 @@ sharp(input)
|
|||||||
|
|
||||||
|
|
||||||
## trim
|
## trim
|
||||||
> trim(trim) ⇒ <code>Sharp</code>
|
> trim([options]) ⇒ <code>Sharp</code>
|
||||||
|
|
||||||
Trim pixels from all edges that contain values similar to the given background colour, which defaults to that of the top-left pixel.
|
Trim pixels from all edges that contain values similar to the given background colour, which defaults to that of the top-left pixel.
|
||||||
|
|
||||||
@ -259,8 +270,7 @@ Images with an alpha channel will use the combined bounding box of alpha and non
|
|||||||
|
|
||||||
If the result of this operation would trim an image to nothing then no change is made.
|
If the result of this operation would trim an image to nothing then no change is made.
|
||||||
|
|
||||||
The `info` response Object, obtained from callback of `.toFile()` or `.toBuffer()`,
|
The `info` response Object will contain `trimOffsetLeft` and `trimOffsetTop` properties.
|
||||||
will contain `trimOffsetLeft` and `trimOffsetTop` properties.
|
|
||||||
|
|
||||||
|
|
||||||
**Throws**:
|
**Throws**:
|
||||||
@ -270,46 +280,44 @@ will contain `trimOffsetLeft` and `trimOffsetTop` properties.
|
|||||||
|
|
||||||
| Param | Type | Default | Description |
|
| Param | Type | Default | Description |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| trim | <code>string</code> \| <code>number</code> \| <code>Object</code> | | the specific background colour to trim, the threshold for doing so or an Object with both. |
|
| [options] | <code>Object</code> | | |
|
||||||
| [trim.background] | <code>string</code> \| <code>Object</code> | <code>"'top-left pixel'"</code> | background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to that of the top-left pixel. |
|
| [options.background] | <code>string</code> \| <code>Object</code> | <code>"'top-left pixel'"</code> | Background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to that of the top-left pixel. |
|
||||||
| [trim.threshold] | <code>number</code> | <code>10</code> | the allowed difference from the above colour, a positive number. |
|
| [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? |
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
// Trim pixels with a colour similar to that of the top-left pixel.
|
// Trim pixels with a colour similar to that of the top-left pixel.
|
||||||
sharp(input)
|
await sharp(input)
|
||||||
.trim()
|
.trim()
|
||||||
.toFile(output, function(err, info) {
|
.toFile(output);
|
||||||
...
|
|
||||||
});
|
|
||||||
```
|
```
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
// Trim pixels with the exact same colour as that of the top-left pixel.
|
// Trim pixels with the exact same colour as that of the top-left pixel.
|
||||||
sharp(input)
|
await sharp(input)
|
||||||
.trim(0)
|
.trim({
|
||||||
.toFile(output, function(err, info) {
|
threshold: 0
|
||||||
...
|
})
|
||||||
});
|
.toFile(output);
|
||||||
```
|
```
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
// Trim only pixels with a similar colour to red.
|
// Assume input is line art and trim only pixels with a similar colour to red.
|
||||||
sharp(input)
|
const output = await sharp(input)
|
||||||
.trim("#FF0000")
|
.trim({
|
||||||
.toFile(output, function(err, info) {
|
background: "#FF0000",
|
||||||
...
|
lineArt: true
|
||||||
});
|
})
|
||||||
|
.toBuffer();
|
||||||
```
|
```
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
// Trim all "yellow-ish" pixels, being more lenient with the higher threshold.
|
// Trim all "yellow-ish" pixels, being more lenient with the higher threshold.
|
||||||
sharp(input)
|
const output = await sharp(input)
|
||||||
.trim({
|
.trim({
|
||||||
background: "yellow",
|
background: "yellow",
|
||||||
threshold: 42,
|
threshold: 42,
|
||||||
})
|
})
|
||||||
.toFile(output, function(err, info) {
|
.toBuffer();
|
||||||
...
|
|
||||||
});
|
|
||||||
```
|
```
|
@ -1,7 +1,13 @@
|
|||||||
|
---
|
||||||
|
# This file was auto-generated from JSDoc in lib/utility.js
|
||||||
|
title: Global properties
|
||||||
|
---
|
||||||
|
|
||||||
## versions
|
## versions
|
||||||
> versions
|
> versions
|
||||||
|
|
||||||
An Object containing the version numbers of sharp, libvips and its dependencies.
|
An Object containing the version numbers of sharp, libvips
|
||||||
|
and (when using prebuilt binaries) its dependencies.
|
||||||
|
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
@ -107,15 +113,9 @@ Some image format libraries spawn additional threads,
|
|||||||
e.g. libaom manages its own 4 threads when encoding AVIF images,
|
e.g. libaom manages its own 4 threads when encoding AVIF images,
|
||||||
and these are independent of the value set here.
|
and these are independent of the value set here.
|
||||||
|
|
||||||
The maximum number of images that sharp can process in parallel
|
:::note
|
||||||
is controlled by libuv's `UV_THREADPOOL_SIZE` environment variable,
|
Further [control over performance](/performance) is available.
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
**Returns**: <code>number</code> - concurrency
|
**Returns**: <code>number</code> - concurrency
|
||||||
@ -150,7 +150,7 @@ const counters = sharp.counters(); // { queue: 2, process: 4 }
|
|||||||
> simd([simd]) ⇒ <code>boolean</code>
|
> simd([simd]) ⇒ <code>boolean</code>
|
||||||
|
|
||||||
Get and set use of SIMD vector unit instructions.
|
Get and set use of SIMD vector unit instructions.
|
||||||
Requires libvips to have been compiled with liborc support.
|
Requires libvips to have been compiled with highway support.
|
||||||
|
|
||||||
Improves the performance of `resize`, `blur` and `sharpen` operations
|
Improves the performance of `resize`, `blur` and `sharpen` operations
|
||||||
by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
|
by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
|
||||||
@ -164,12 +164,12 @@ by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM N
|
|||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
const simd = sharp.simd();
|
const simd = sharp.simd();
|
||||||
// simd is `true` if the runtime use of liborc is currently enabled
|
// simd is `true` if the runtime use of highway is currently enabled
|
||||||
```
|
```
|
||||||
**Example**
|
**Example**
|
||||||
```js
|
```js
|
||||||
const simd = sharp.simd(false);
|
const simd = sharp.simd(false);
|
||||||
// prevent libvips from using liborc at runtime
|
// prevent libvips from using highway at runtime
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
1
docs/src/content/docs/changelog/_meta.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
sort: reverse-slug
|
22
docs/src/content/docs/changelog/v0.10.0.md
Normal 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)
|
12
docs/src/content/docs/changelog/v0.10.1.md
Normal 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)
|
30
docs/src/content/docs/changelog/v0.11.0.md
Normal 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)
|
12
docs/src/content/docs/changelog/v0.11.1.md
Normal 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)
|
10
docs/src/content/docs/changelog/v0.11.2.md
Normal 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)
|
8
docs/src/content/docs/changelog/v0.11.3.md
Normal 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)
|
16
docs/src/content/docs/changelog/v0.11.4.md
Normal 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)
|
38
docs/src/content/docs/changelog/v0.12.0.md
Normal 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)
|
15
docs/src/content/docs/changelog/v0.12.1.md
Normal 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.
|
20
docs/src/content/docs/changelog/v0.12.2.md
Normal 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)
|
47
docs/src/content/docs/changelog/v0.13.0.md
Normal 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.
|
8
docs/src/content/docs/changelog/v0.13.1.md
Normal 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)
|
39
docs/src/content/docs/changelog/v0.14.0.md
Normal 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)
|
26
docs/src/content/docs/changelog/v0.14.1.md
Normal 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)
|
20
docs/src/content/docs/changelog/v0.15.0.md
Normal 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)
|
68
docs/src/content/docs/changelog/v0.15.1.md
Normal 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)
|
42
docs/src/content/docs/changelog/v0.16.0.md
Normal 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)
|
21
docs/src/content/docs/changelog/v0.16.1.md
Normal 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)
|
8
docs/src/content/docs/changelog/v0.16.2.md
Normal 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)
|
39
docs/src/content/docs/changelog/v0.17.0.md
Normal 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)
|
15
docs/src/content/docs/changelog/v0.17.1.md
Normal 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)
|
12
docs/src/content/docs/changelog/v0.17.2.md
Normal 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)
|
20
docs/src/content/docs/changelog/v0.17.3.md
Normal 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)
|
60
docs/src/content/docs/changelog/v0.18.0.md
Normal 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)
|
8
docs/src/content/docs/changelog/v0.18.1.md
Normal 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)
|
19
docs/src/content/docs/changelog/v0.18.2.md
Normal 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)
|
12
docs/src/content/docs/changelog/v0.18.3.md
Normal 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)
|
8
docs/src/content/docs/changelog/v0.18.4.md
Normal 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)
|
46
docs/src/content/docs/changelog/v0.19.0.md
Normal 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.
|
16
docs/src/content/docs/changelog/v0.19.1.md
Normal 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)
|
7
docs/src/content/docs/changelog/v0.20.0.md
Normal 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)
|
15
docs/src/content/docs/changelog/v0.20.1.md
Normal 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)
|
20
docs/src/content/docs/changelog/v0.20.2.md
Normal 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)
|
8
docs/src/content/docs/changelog/v0.20.3.md
Normal 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)
|
12
docs/src/content/docs/changelog/v0.20.4.md
Normal 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)
|
8
docs/src/content/docs/changelog/v0.20.5.md
Normal 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)
|
33
docs/src/content/docs/changelog/v0.20.6.md
Normal 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.
|
7
docs/src/content/docs/changelog/v0.20.7.md
Normal 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)
|
12
docs/src/content/docs/changelog/v0.20.8.md
Normal 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)
|
39
docs/src/content/docs/changelog/v0.21.0.md
Normal 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)
|
31
docs/src/content/docs/changelog/v0.21.1.md
Normal 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)
|
27
docs/src/content/docs/changelog/v0.21.2.md
Normal 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)
|
9
docs/src/content/docs/changelog/v0.21.3.md
Normal 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)
|
20
docs/src/content/docs/changelog/v0.22.0.md
Normal 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)
|
15
docs/src/content/docs/changelog/v0.22.1.md
Normal 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)
|
32
docs/src/content/docs/changelog/v0.23.0.md
Normal 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)
|
24
docs/src/content/docs/changelog/v0.23.1.md
Normal 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.
|
12
docs/src/content/docs/changelog/v0.23.2.md
Normal 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)
|
18
docs/src/content/docs/changelog/v0.23.3.md
Normal 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)
|
12
docs/src/content/docs/changelog/v0.23.4.md
Normal 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)
|
28
docs/src/content/docs/changelog/v0.24.0.md
Normal 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)
|
10
docs/src/content/docs/changelog/v0.24.1.md
Normal 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)
|
18
docs/src/content/docs/changelog/v0.25.0.md
Normal 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)
|
7
docs/src/content/docs/changelog/v0.25.1.md
Normal 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)
|
19
docs/src/content/docs/changelog/v0.25.2.md
Normal 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)
|