mirror of
https://github.com/lovell/sharp.git
synced 2025-07-20 15:22:28 +02:00
Compare commits
1538 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
67462bee79 | ||
|
628454559e | ||
|
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 | ||
|
7cf4ae5648 | ||
|
9161c605e1 | ||
|
70ac6905c7 | ||
|
265d70111a | ||
|
59327bdd53 | ||
|
3043e01171 | ||
|
36feb7551b | ||
|
a41c62be2b | ||
|
854ed65016 | ||
|
8f63d131a4 | ||
|
70a3067963 | ||
|
aabbe1fa08 | ||
|
0f8bb9196e | ||
|
efee9f1779 | ||
|
61c5cb4669 | ||
|
e618c17bd0 | ||
|
6578118f32 | ||
|
ba20b8ada4 | ||
|
eefaa99872 | ||
|
dbce6fab79 | ||
|
af0fcb37c2 | ||
|
c6f54e59da | ||
|
846563e45f | ||
|
9c217ab580 | ||
|
e7381e522e | ||
|
4340d60ccf | ||
|
7f64d464de | ||
|
67e927bdb6 | ||
|
9c7713ed54 | ||
|
8be6da1def | ||
|
95635683ac | ||
|
44a0ee3fd3 | ||
|
ccd51c8cbf | ||
|
bb7469b2d1 | ||
|
a2cac61209 | ||
|
5c19f6dd9b | ||
|
3d01775972 | ||
|
87562a5111 | ||
|
2829e17743 | ||
|
ffefbd2ecc | ||
|
bc8f983329 | ||
|
440936a699 | ||
|
0bc79cdb95 | ||
|
9a66e25f53 | ||
|
8370935ccf | ||
|
f908987f35 | ||
|
aea368a3a0 | ||
|
7ecbc20d3d | ||
|
cb0e2a91c4 | ||
|
739b317a6f | ||
|
a0e1c39785 | ||
|
85b26dab68 | ||
|
66f7cef253 | ||
|
863174f201 | ||
|
bcd865cc96 | ||
|
16ea04fe80 | ||
|
9c547dc321 | ||
|
5522060e9e | ||
|
d2f0fa855b | ||
|
2bb3ea8170 | ||
|
3434eef5b9 | ||
|
2f67823c3d | ||
|
38c760cdd7 | ||
|
14c3346800 | ||
|
0da55bab7e | ||
|
cfb659f576 | ||
|
cc5ac5385f | ||
|
93fafb0c18 | ||
|
41e3c8ca09 | ||
|
da61ea0199 | ||
|
7e6a70af44 | ||
|
f5845c7e61 | ||
|
eb1e53db83 | ||
|
3340120aea | ||
|
de0fc07092 | ||
|
dc4b39f73f | ||
|
e873978e53 | ||
|
5255964c79 | ||
|
dea319daf6 | ||
|
a2ca678854 | ||
|
e98993a6e2 | ||
|
90abd927c9 | ||
|
4d7957a043 | ||
|
bf9bb56367 | ||
|
8408e99aa3 | ||
|
a39f959dcc | ||
|
d08baa20e6 | ||
|
391018ad3d | ||
|
afed876f90 | ||
|
d6b60a60c6 | ||
|
5f8646d937 | ||
|
b763801d68 | ||
|
2e0f789c9b | ||
|
a8645f0f38 | ||
|
7b58ad9360 | ||
|
9ebbcc3701 | ||
|
e87204b92c | ||
|
a4c6eba7d4 | ||
|
b9c3851515 | ||
|
97cf69c26a | ||
|
d5be024bfd | ||
|
de01fc44e7 | ||
|
ca102ebd6c | ||
|
b9d4c30a9f | ||
|
148760fe55 | ||
|
98ed237734 | ||
|
b55e58f31e | ||
|
0af070ed93 | ||
|
9fbb4fcaef | ||
|
6008ff8a08 | ||
|
cd5e11bd50 | ||
|
08d6822265 | ||
|
8b8a815fbb | ||
|
a44da850c1 | ||
|
c5ef4677b1 | ||
|
f8a430bdd3 | ||
|
cd419a261b | ||
|
d7776e3b98 | ||
|
1eefd4e562 | ||
|
0a16d26ec7 | ||
|
fc03fba602 | ||
|
c87fe512b4 | ||
|
2eaab59c48 | ||
|
4ec883eaa0 | ||
|
0063df4d4f | ||
|
6c61ad256f | ||
|
b90474affa | ||
|
34cbc6dec3 | ||
|
bb8de0cc26 | ||
|
863e37455a | ||
|
6f0e6f2e65 | ||
|
ebf4ccd124 | ||
|
b96c8e8ba4 | ||
|
42d2f07e44 | ||
|
a2988c9edc | ||
|
24b3344937 | ||
|
9608f219bd | ||
|
4798d9da64 | ||
|
8d8c6b70eb | ||
|
9e2207f376 | ||
|
802f560b9b | ||
|
a532659b0f | ||
|
25c6da2bcd | ||
|
02f855d57a | ||
|
c150263ef1 | ||
|
9f79f80a93 | ||
|
069803b83d | ||
|
f79760b4f2 | ||
|
aa5f0f4e40 | ||
|
286a322622 | ||
|
6d404f4d2c | ||
|
bdc50e1d6e | ||
|
a9bd0e79f8 | ||
|
a1e464cc5e | ||
|
081debd055 | ||
|
ef849fd639 | ||
|
a42a975c46 | ||
|
e8273580af | ||
|
5be36c2deb | ||
|
6cda090ce2 | ||
|
eac6e8b261 | ||
|
844deaf480 | ||
|
efbb0c22fd | ||
|
da0b594900 | ||
|
78dada9126 | ||
|
15f5cd4671 | ||
|
9eb2e94404 | ||
|
e40b068628 | ||
|
2c46528269 | ||
|
584807b4f5 | ||
|
a7fa7014ef | ||
|
f92e33fbff | ||
|
0f1e7ef6f6 | ||
|
89e204d824 | ||
|
2a71f1830f | ||
|
def99a294a | ||
|
9d760f3958 | ||
|
0265d305fe | ||
|
a472aea025 | ||
|
01ffa80338 | ||
|
789d4851ea | ||
|
4490a93430 | ||
|
ac0dc10bd5 | ||
|
5740f4545e | ||
|
a9d692fb43 | ||
|
df971207b8 | ||
|
3a64a0529a | ||
|
76cda885fb | ||
|
1a563360c6 | ||
|
ca22af203f | ||
|
9fa516e849 | ||
|
12f472126d | ||
|
18be09f1d7 | ||
|
b3c3290f90 | ||
|
123f95c85a | ||
|
5b0fba4c01 | ||
|
37f7ccfff4 | ||
|
51811d06e2 | ||
|
181731f8f4 | ||
|
ae79d26ead | ||
|
eacb8337fa | ||
|
99bf279de8 | ||
|
1b0eb6ab53 | ||
|
891cf67d0b | ||
|
eaf8a86bf2 | ||
|
3400976d61 | ||
|
2d49f0e93e | ||
|
b0c69f1ee9 | ||
|
27d0c35a01 | ||
|
32a22b5420 | ||
|
d1004eed02 | ||
|
70e6bb0162 | ||
|
32aa3b4b20 | ||
|
df24b30755 | ||
|
4de74bea94 | ||
|
28b87db760 | ||
|
fbd4970b57 | ||
|
f5da147a58 | ||
|
eee0dd36d9 | ||
|
f7b29d7b59 | ||
|
0b806187fc | ||
|
c1393daa70 | ||
|
31c1cfb049 | ||
|
afc35c2208 | ||
|
6eb2add3bf | ||
|
5cdb2b83d5 | ||
|
1eb66c0944 | ||
|
55c4d8807c | ||
|
9a54a034e1 | ||
|
f5109560d6 | ||
|
953a94885b | ||
|
0e3bd46ca3 | ||
|
4b38f56d02 | ||
|
0fe857c5ac | ||
|
1bf06bd5b4 | ||
|
6e3f4c3c92 | ||
|
8583eb1235 | ||
|
c3a852eecf | ||
|
3a44748f49 | ||
|
e1bc8674fd | ||
|
a618ce7a15 | ||
|
a44168c8c7 | ||
|
74e3f73934 | ||
|
b9261c243c | ||
|
cc9f91f37c | ||
|
212a6e7519 | ||
|
e547eaa180 | ||
|
9a0d9eed74 | ||
|
dd56a9699e | ||
|
ea7cf2a2ef | ||
|
76c4c51e2a | ||
|
b46ab510da | ||
|
3e327a586c | ||
|
974fab946e | ||
|
f998a8f249 | ||
|
be331e958e | ||
|
254944f8ab | ||
|
f1e640d231 | ||
|
c295f06a6f | ||
|
6288c7bced | ||
|
d247c02762 | ||
|
1b84ccbbe9 | ||
|
e4160c684d | ||
|
905518fab0 | ||
|
8ff33763ce | ||
|
cbf741cac7 | ||
|
6c2e2be41d | ||
|
e0d3c6e05d | ||
|
e3cab7f10f | ||
|
204463ffbb | ||
|
1bcd3700c5 | ||
|
c99a11cff5 | ||
|
81c74f57e0 | ||
|
7a8ab452c5 | ||
|
bb91912883 | ||
|
afc4c5bf79 | ||
|
e40a881ab4 | ||
|
c1b13adac3 | ||
|
29e09898f7 | ||
|
853a20358e | ||
|
8bb30d7801 | ||
|
a333b87f5d | ||
|
4662527a17 | ||
|
b10d8f89ca | ||
|
f903e1465e | ||
|
a75718565c | ||
|
4d82331bf6 | ||
|
b91875d3d9 | ||
|
a0568ec0c3 | ||
|
48e3ea5e29 | ||
|
93b29057e4 | ||
|
db654de385 | ||
|
a6aeef612b | ||
|
7bf6cbd669 | ||
|
04c31b35a7 | ||
|
ee9cdb6598 | ||
|
8960eb8309 | ||
|
54d9dc46f5 | ||
|
51b4a7c564 | ||
|
5b03579e5c | ||
|
58c2af3251 | ||
|
ee948ac6fa | ||
|
66a3ce5e55 | ||
|
75e5afcd42 | ||
|
d396a4e65d | ||
|
ae1dbcdf4e | ||
|
4c29368b51 | ||
|
36e55969d2 | ||
|
985e881e7a | ||
|
0b116715aa | ||
|
9deac83322 | ||
|
5d36f5f699 | ||
|
926572b41e | ||
|
d0c8e95641 | ||
|
b0ca23c3e7 | ||
|
c3a0d5f5d0 | ||
|
1d36936954 | ||
|
b609df4b48 | ||
|
c567d3b9ab | ||
|
27d9fe2a4e | ||
|
ac883c5215 | ||
|
e8720c9374 | ||
|
42e45d842a | ||
|
72fd8abe2c | ||
|
ac18bbbc7c | ||
|
fcbe4e1e01 | ||
|
9280742385 | ||
|
7a1a1cf9e8 | ||
|
ea599ade10 | ||
|
1de49f3ed8 | ||
|
4ac65054bc | ||
|
23033e2050 | ||
|
dd3b78272a | ||
|
80d169b7c2 | ||
|
003279a0b0 | ||
|
af80d7e389 | ||
|
21a960796c | ||
|
fc3b4a683d | ||
|
808133e7dc | ||
|
801b6fea6c | ||
|
c2ecde6a16 | ||
|
55efe5602b | ||
|
c62002554b | ||
|
7f83ecd255 | ||
|
dc5f4dcd28 | ||
|
735793ba99 | ||
|
47792df689 | ||
|
5c6cdfaece | ||
|
115a6b10f6 | ||
|
4feee506cf | ||
|
83db5f8a2a | ||
|
7eb5efa3a3 | ||
|
5a9f89fe06 | ||
|
02e0c2dfc9 | ||
|
968d9d7008 | ||
|
7faacd91b0 | ||
|
154eaff4ec | ||
|
424660278d | ||
|
2b01951306 | ||
|
83bb6a4554 | ||
|
c72d42816d | ||
|
35a81a7af2 | ||
|
9dc8db4370 | ||
|
47ae1f52db | ||
|
ec17d7f580 | ||
|
da5453a7c0 | ||
|
f7bed69ffb | ||
|
7aa340232e | ||
|
68823a5edb | ||
|
1c3ba303ea | ||
|
76f8112952 | ||
|
24150eac89 | ||
|
51121a1440 | ||
|
3b370b6c01 | ||
|
884947a069 | ||
|
f8340e1a82 | ||
|
5101f4e79c | ||
|
161d127bf3 | ||
|
638d540371 | ||
|
d8f1298511 | ||
|
d67e09ba7c | ||
|
4c3a8a7007 | ||
|
92399ee5e2 | ||
|
96992845ed | ||
|
2b8e4d20de | ||
|
dd6583044b | ||
|
446e4e3c3a | ||
|
3b492ea423 | ||
|
3da258f6fb | ||
|
9755629cfd | ||
|
5bb6702717 | ||
|
8c0660d71e | ||
|
513fb40f40 | ||
|
659cdabd8e | ||
|
add4c7928f | ||
|
336856dfc2 | ||
|
e1ba2a7fd8 | ||
|
2b1f5cbe07 | ||
|
72025051c5 | ||
|
140eeebb3d | ||
|
407bfcb42a | ||
|
549219f32a | ||
|
afab0d34dd | ||
|
2deced0fb9 | ||
|
2a0077c481 | ||
|
f7f3e43490 | ||
|
b876abaf88 | ||
|
dcd9a3c558 | ||
|
a06b8c296a | ||
|
602f988aba | ||
|
079bd7b9f5 | ||
|
1ff84b20b7 | ||
|
97655d2dfd | ||
|
d10d7b02d4 | ||
|
2ffdae2914 | ||
|
342de36973 | ||
|
b33231d4bd | ||
|
319db21f29 | ||
|
d359331426 | ||
|
7ae151362b | ||
|
648a1e05da | ||
|
b9f211fe34 | ||
|
e475d9e47f | ||
|
f37ca8249a | ||
|
1dd4be670d | ||
|
197d4cf835 | ||
|
83eed86b53 | ||
|
bbf612cb9e | ||
|
2679bb567b | ||
|
481e350f39 | ||
|
50c7a08754 | ||
|
9a0bb60737 | ||
|
deb5d81221 | ||
|
916b04dbac | ||
|
52307fad5d | ||
|
afb21135c2 | ||
|
b7fbffb3f7 | ||
|
5d98bcd8d8 | ||
|
e044788f63 | ||
|
4a9267ce12 | ||
|
104464c2e0 | ||
|
60adc110f5 | ||
|
2031d7d112 | ||
|
3402656ec5 | ||
|
4e84f743e4 | ||
|
17e50de5f0 | ||
|
978a788f40 | ||
|
6e91d55971 | ||
|
d4ce0a1e36 | ||
|
148608b377 | ||
|
f725f4acb7 | ||
|
d07a549438 | ||
|
551441cedd | ||
|
46c14e939b | ||
|
6084647795 | ||
|
e0a598ae62 | ||
|
28833eb04a | ||
|
b24c9c86d1 | ||
|
b7add480c7 | ||
|
eabb671b10 | ||
|
513ed02b76 | ||
|
b7ddbe71f7 | ||
|
21d1a7ca62 | ||
|
4c2d28a7ad | ||
|
2afec9e3ed | ||
|
69790421b7 | ||
|
3f08f6a359 | ||
|
719c2db8da | ||
|
a9aa55c32d | ||
|
3f6d9d6ee9 | ||
|
b32568159f | ||
|
bb48d0d857 | ||
|
536412515f | ||
|
fcc6eaadd3 | ||
|
7dc78e8796 | ||
|
c65de3fe6d | ||
|
d000f57773 | ||
|
75cddbdb6d | ||
|
e418d91511 | ||
|
6c2e6c5432 | ||
|
8c6d9fdc62 | ||
|
468e95427e | ||
|
6d7a5ace6b | ||
|
cbaec198a5 | ||
|
7467fa8b50 | ||
|
61640fb5c7 | ||
|
19cb4b62b0 | ||
|
81ee8bc30f | ||
|
9f384e1c6c | ||
|
35e8c8b25e | ||
|
dc53f1baff | ||
|
70139600b5 | ||
|
1b4d1521e0 | ||
|
ed3377cb2d | ||
|
d72852b3aa | ||
|
4b6b6189bf | ||
|
b69a54fc75 | ||
|
81e388a4cc | ||
|
5bd5e5052a | ||
|
a2d3fa729f | ||
|
cb6811bc47 | ||
|
53c6e80869 | ||
|
e71dca586c | ||
|
b3cd48db5f | ||
|
476448b9d4 | ||
|
070534df5b | ||
|
9a1e8ed574 | ||
|
309918a878 | ||
|
cac83b94c1 | ||
|
9c06df08a1 | ||
|
52e4543d31 | ||
|
a688468378 | ||
|
e1760d64fb | ||
|
84d4e3cf8f | ||
|
f8a76372ad | ||
|
4237f5520f | ||
|
8c0c01c702 | ||
|
9c100830e0 | ||
|
ed5d753b89 | ||
|
d1ca756bd8 | ||
|
16cf9f0ef2 | ||
|
133f69d66c | ||
|
bc60daff9e | ||
|
43a085d1ae | ||
|
8c33d0aa56 | ||
|
fe0767df13 | ||
|
08a25a0c8f | ||
|
cd410080bd | ||
|
7555378e3b | ||
|
80c95ee66a | ||
|
31563b210d | ||
|
861cd93324 | ||
|
abb344bb1a | ||
|
6147491d9e | ||
|
f1f18fbb4a | ||
|
9fc611f257 | ||
|
34a2e14a14 | ||
|
83fe65b9e9 | ||
|
ec26c8aa49 | ||
|
da43a3055f | ||
|
a38126c82f | ||
|
cb592ce588 | ||
|
d69c58a6da | ||
|
bdb1986e08 | ||
|
55356c78a8 | ||
|
a0f55252b1 | ||
|
013f5cffa9 | ||
|
d5d008f568 | ||
|
3b02134cdc | ||
|
a57d7b51b1 | ||
|
1a3c38d35f | ||
|
00aece0538 | ||
|
5a9cc835b3 | ||
|
58526cc849 | ||
|
955b5f43a5 | ||
|
447aec3fde | ||
|
473260a836 | ||
|
4d2784c10c | ||
|
d9af897595 | ||
|
23a48be315 | ||
|
ce8f48e5d1 | ||
|
6aaf839662 | ||
|
984a9e653e | ||
|
8dffa28b4d | ||
|
b05a4bdadd | ||
|
36087fe518 | ||
|
5eed87ec4d | ||
|
af66a73225 | ||
|
dcf913c17e | ||
|
68ccba8f74 | ||
|
956f7e29db | ||
|
4264c0577e | ||
|
cc37b59309 | ||
|
9f2f92095d | ||
|
0c1075c089 | ||
|
9c64710c8b | ||
|
f6f16b91db | ||
|
1986b5cfe6 | ||
|
6445b72d41 | ||
|
df7b8ba738 | ||
|
202083999e | ||
|
315f519e1d | ||
|
d7d580ae6f | ||
|
7017af303d | ||
|
0dc325daa4 | ||
|
6dffb47973 | ||
|
b19dad69d6 | ||
|
94c5ac64e9 | ||
|
c4bcd088fb | ||
|
aeecbe9396 | ||
|
171aade9cd | ||
|
67213ae86c | ||
|
24d9e53c3f | ||
|
573ed5f4b5 | ||
|
ceff628add | ||
|
0bb8cb9203 | ||
|
98349bde28 | ||
|
f09be932eb | ||
|
4c57ac2bbe | ||
|
1dd93c1b6b | ||
|
c9f85fe27f | ||
|
419cbe50f6 | ||
|
5031c8323f | ||
|
762d5913ce | ||
|
290df1b1c7 | ||
|
79170afc51 | ||
|
bba00c2bfe | ||
|
f7e2b3688f | ||
|
8d49b7dde1 | ||
|
138e60adb3 | ||
|
d6376c31e0 | ||
|
a7003e93c8 | ||
|
4821a11223 | ||
|
bf1b326988 | ||
|
39ddb6a175 | ||
|
b2a0b8c0f0 | ||
|
4debc46d0e | ||
|
f4e259d10f | ||
|
774d78228e | ||
|
0e62bde5c3 | ||
|
2bbd9b23e6 | ||
|
02676140e8 | ||
|
182beaa4a1 | ||
|
7c08a09529 | ||
|
ef964b5472 | ||
|
ee54ce9913 | ||
|
e59e146887 | ||
|
103ec0d58f | ||
|
a0d89ed514 | ||
|
c10888e6fe | ||
|
93455f8eb5 | ||
|
65acd96c8d | ||
|
fabe720b9b | ||
|
53dd313e97 | ||
|
2678d7a660 | ||
|
46718102c6 | ||
|
0f473fe3b1 | ||
|
2872602c9e | ||
|
ab653cae33 | ||
|
e6a035e575 | ||
|
fbe48d75dd | ||
|
20ba0f49dd | ||
|
c213e9878d | ||
|
9704ca4c18 | ||
|
49dce6219e | ||
|
260ff6c94f | ||
|
3ec281d104 | ||
|
c4c43d525b | ||
|
6c5cde363a | ||
|
d46b4d950f | ||
|
b369c4bb8a | ||
|
c3898487c4 | ||
|
ca3c5b400f | ||
|
97772b176c | ||
|
08a2965f1c | ||
|
76dcddfa3d | ||
|
79f476ae4d | ||
|
d406cb619c | ||
|
4f3890f1e4 | ||
|
7a9d58cc51 | ||
|
eef87da0e1 | ||
|
00e65f6f14 | ||
|
866e9824d1 | ||
|
482e6078e2 | ||
|
bc7ab296ef | ||
|
a5f4f53b56 | ||
|
b1227f526d | ||
|
78b42c8306 | ||
|
4b6d45ab8e | ||
|
7980341923 | ||
|
3917efdebd | ||
|
eaecb7347b | ||
|
05ca7d3129 | ||
|
4beae0de71 | ||
|
b711661784 | ||
|
0c4a45b1f4 | ||
|
ec2beb0039 | ||
|
cafb3e8bac | ||
|
e896d5e920 | ||
|
42d4228595 | ||
|
341ea3e4ea | ||
|
cb1baede87 | ||
|
45653ca2e7 | ||
|
77c861b74b | ||
|
b586c2146f | ||
|
4d42bed4f8 | ||
|
ea54c119ab | ||
|
d95b124771 | ||
|
61ccf09e6f | ||
|
8da30f0b41 | ||
|
90a57e7664 | ||
|
c42de19d2a | ||
|
dcc42f8514 | ||
|
3150fad909 | ||
|
ba17db3ab3 | ||
|
7c1c48327e | ||
|
85459e0ec6 | ||
|
13bdb68366 | ||
|
c91373fba3 | ||
|
e8149f5295 | ||
|
ab015ef90f | ||
|
fdfc89e577 | ||
|
e647e1f7bd | ||
|
a05d735e31 | ||
|
4470048ba4 | ||
|
0f58f956a7 | ||
|
20284757a6 | ||
|
df6efa0285 | ||
|
3c10e118e3 | ||
|
19980190f7 | ||
|
8f5495a446 | ||
|
9431029917 | ||
|
17ea70a102 | ||
|
7f142bddb3 | ||
|
98e0516ac1 | ||
|
7717516d1d | ||
|
760550ca0d | ||
|
f8144dd89c | ||
|
ac4070cb49 | ||
|
25b964e3df | ||
|
17ec6c72df | ||
|
a7b1185602 | ||
|
c76ae06fd1 | ||
|
b3dd54d550 | ||
|
d248eadb06 | ||
|
507eef3053 | ||
|
fc2f672337 | ||
|
6f49be8f26 | ||
|
dad7f1e1f6 | ||
|
c3a9384dcf | ||
|
0ee08bfe46 | ||
|
0872f495f9 | ||
|
33ac8b93a9 | ||
|
bbff1c222d | ||
|
b534f99870 | ||
|
86acf2460e | ||
|
40c00035ee | ||
|
4673abae7d | ||
|
ef8a705957 | ||
|
48255fa009 | ||
|
ed6269bc9c | ||
|
16b8d9afe5 | ||
|
f29fcb1f73 | ||
|
b36ad25030 | ||
|
edf3fe24c9 | ||
|
5a1bdf0eb1 | ||
|
d8e24d7e76 | ||
|
786c5330e9 | ||
|
70e730bb67 | ||
|
1d6ef630a5 | ||
|
1eedb22ef5 | ||
|
6ed1f49ad3 | ||
|
ecd01afad3 | ||
|
8bd8709f2b | ||
|
e82a585cec | ||
|
c1d4a68558 | ||
|
eff36dc09f | ||
|
031a58f817 | ||
|
cf39fc4fb1 | ||
|
c9bff94e17 | ||
|
e78e919925 | ||
|
76bb25262e | ||
|
d8426b1ed5 | ||
|
4894c10dd9 | ||
|
24285bb0e0 | ||
|
bf75501262 | ||
|
9e214a17f0 | ||
|
0aae1ecd9b | ||
|
062f990315 | ||
|
22685e44c0 | ||
|
8d66433e7c | ||
|
82863f48f6 | ||
|
51b14329d6 | ||
|
14dc7681ed | ||
|
258c9e86eb | ||
|
03dad5f2b2 | ||
|
86264e7733 | ||
|
95eae905f0 | ||
|
a90dbcc808 | ||
|
e9b21f2211 | ||
|
409e5174bb | ||
|
8b3c0daab2 | ||
|
c17807c995 | ||
|
4abb4edf64 | ||
|
d5ecc537af | ||
|
c7a49054fd | ||
|
a2314c4aa0 | ||
|
1717173f17 | ||
|
e44c12f029 | ||
|
1a98c390fc | ||
|
91902740e4 | ||
|
6aa6a93b44 | ||
|
b4135ac9b3 | ||
|
78906e6551 | ||
|
ba29ba1ab7 | ||
|
e0fa15f5cb | ||
|
82a1ff359d | ||
|
18e1f10a94 | ||
|
4828a17643 | ||
|
3b4f95597a | ||
|
bd52e93fca | ||
|
6fdc79d569 | ||
|
7dbad7206e | ||
|
a8a0c1e935 | ||
|
00bcf60566 | ||
|
4a745f2d2e | ||
|
057074b238 | ||
|
4b8cc13a05 | ||
|
a4e8586b59 | ||
|
095b37db6a | ||
|
efff650314 | ||
|
0764ca8fde | ||
|
403160434b | ||
|
730ab14faa | ||
|
51d70c4574 | ||
|
765ccd2aaa | ||
|
5399332f81 | ||
|
43b7f9fc0e | ||
|
3925689435 | ||
|
96a994a4c0 | ||
|
84c20373ec | ||
|
a216d2945b | ||
|
755a0caf3d | ||
|
703d90e663 | ||
|
e230ce41d7 | ||
|
596b38a3bb | ||
|
d31a91a599 | ||
|
400ef71b6f | ||
|
bb15cd9067 | ||
|
6ee6a226e1 | ||
|
94d51a94c8 | ||
|
d0feb4156c | ||
|
0d1278dade | ||
|
1b401b1195 | ||
|
11daa3b4d1 | ||
|
88a3919ce0 | ||
|
c41b87303d | ||
|
833aaead56 | ||
|
ff98d2e44a | ||
|
fcf05f608a | ||
|
9baf38db44 | ||
|
69050ef1c8 | ||
|
b35b9f7850 | ||
|
500ae97cac | ||
|
d5b7040557 | ||
|
ca52894651 | ||
|
4009acdd30 | ||
|
147c93ecd3 | ||
|
8e04e4b07f | ||
|
e7413ea1e5 | ||
|
220bb03a32 | ||
|
20f512fe5f | ||
|
efb3523eaa | ||
|
2f2276e091 | ||
|
08a6597626 | ||
|
d82a6ee4fc | ||
|
e627f6d68d | ||
|
e650f58bd8 | ||
|
5a9b6c8afd | ||
|
075771d1e9 | ||
|
4fcf091fef | ||
|
0e66454fe4 | ||
|
aa3ce760bb | ||
|
ba46ad1fd9 | ||
|
11214bab5d | ||
|
d87c289b4a | ||
|
af45c03b6f | ||
|
7d6fadce6b | ||
|
6b560f7a85 | ||
|
5d4221460d | ||
|
d42c383992 | ||
|
9c7f6fcb2b | ||
|
14af0bda61 | ||
|
fb5c393fbd | ||
|
69fe21a7ec | ||
|
da4e05c118 | ||
|
e4333ff6b0 | ||
|
4ae8999f62 | ||
|
3fa91bb4ce | ||
|
23b2e541ab | ||
|
5bfcf61a6f | ||
|
0778c112a9 | ||
|
2c300754a7 | ||
|
c610e306df | ||
|
417cca6e0d | ||
|
2ed4b5ae83 | ||
|
16e429cf2c | ||
|
6b7ce8a605 | ||
|
ba4ce75377 | ||
|
76ded7fd28 | ||
|
a0d1a7be50 | ||
|
690bc43abe | ||
|
50b461024d | ||
|
6cf0b3240d | ||
|
233b015d77 | ||
|
28de243c11 | ||
|
36e8a3da88 | ||
|
119d16cad3 | ||
|
38402d3185 | ||
|
6c02949fc1 | ||
|
b737d4601e | ||
|
3ff3353550 | ||
|
946d3c81a5 | ||
|
628996846d | ||
|
631a3597c7 | ||
|
cfa4f7d45c | ||
|
05d76eeadf | ||
|
28a6c53da0 | ||
|
6fcd2153c5 | ||
|
7ae0512b9b | ||
|
0890b59c32 | ||
|
df3ce450d9 | ||
|
bb0257b318 | ||
|
9c3597670d | ||
|
aa9b328778 | ||
|
159e8dace2 | ||
|
3be4d5bb45 | ||
|
af7caa7b25 | ||
|
b4ede75522 | ||
|
9d98114074 | ||
|
4ac51899c3 | ||
|
90a0382317 | ||
|
687795c801 | ||
|
2e0fbbb942 | ||
|
0a3512d066 | ||
|
6032171f91 | ||
|
fc178de309 | ||
|
3f4398457f | ||
|
b494b2e872 | ||
|
18afcf5f90 | ||
|
87a422942d | ||
|
ac515121e5 | ||
|
2bfea0ad76 | ||
|
83cdb558f6 | ||
|
9ee377963e | ||
|
9cc06c887b | ||
|
7457b50373 | ||
|
6387fb79b1 | ||
|
54e5514b9a | ||
|
1e4597c284 | ||
|
7cafd4386c | ||
|
e3549ba28c | ||
|
d1bbe62e52 | ||
|
36af74a09b | ||
|
5afe02be60 | ||
|
2262959673 | ||
|
ba3f914445 | ||
|
770be35c44 | ||
|
cc9f2b90fd | ||
|
4aff57b071 | ||
|
1df8d82fe0 | ||
|
98e90784f4 | ||
|
87ea54cc66 | ||
|
d5e98bc8ad | ||
|
fa69ff773a | ||
|
a183bb1cac | ||
|
cf62372cab | ||
|
56fa9c95a1 | ||
|
32a34a8841 | ||
|
98797445de | ||
|
bd377438b6 | ||
|
9dd6510de6 | ||
|
93ad9d4a4a | ||
|
4c01a099ea | ||
|
8e70579e47 | ||
|
ee8bfa3980 | ||
|
c5dfa49cae | ||
|
0822404129 | ||
|
144f39cd45 | ||
|
87f191fd05 | ||
|
37ed436202 | ||
|
88e490356d | ||
|
7c631c0787 | ||
|
f5d3721fe0 | ||
|
cc633589d9 | ||
|
cc1d4c1a6d | ||
|
30ca424942 | ||
|
813831acf0 | ||
|
a54fe9f77c | ||
|
8c6da5548a | ||
|
a2aa7d69e7 | ||
|
34d5252242 | ||
|
f31e4d2869 | ||
|
c695c40abc | ||
|
fd1ca1dbb2 | ||
|
f25dbd5f61 | ||
|
541e7104fd | ||
|
94945cf6ac | ||
|
db76e655f8 | ||
|
d43c7b581d | ||
|
383b933e26 | ||
|
d26ccf6294 | ||
|
6f9699f605 | ||
|
1e9093d781 | ||
|
9dc6492e52 | ||
|
d22f7cae6a | ||
|
473afaab45 | ||
|
dcd68303a4 | ||
|
03394556b5 | ||
|
1c4f6f75f3 | ||
|
f00928dedb | ||
|
a48f8fbb61 | ||
|
1fa388370e | ||
|
95ef6b3f71 | ||
|
de11d36d00 | ||
|
d77c2adabe | ||
|
c89c055ae0 | ||
|
dac8117f32 | ||
|
937b091bab | ||
|
019e6a1bfe | ||
|
1565e58fcf | ||
|
c22e2a17ef | ||
|
fd2a10ccea | ||
|
0725378257 | ||
|
c431909f35 | ||
|
db4df6f0b2 | ||
|
17f942c802 | ||
|
60438ebfe5 | ||
|
21fbe546b8 | ||
|
11900945eb | ||
|
ea5270221b | ||
|
a64844689e | ||
|
6007e13a22 | ||
|
c3274e480b | ||
|
3c54eeda5b | ||
|
6236e4b97d | ||
|
796738da65 | ||
|
37d385fafa | ||
|
db2af42ee7 | ||
|
24b42ef192 | ||
|
2ce166ab0a | ||
|
71755b69e4 | ||
|
1106aac2d8 | ||
|
93aac660a3 | ||
|
0ce8ad7130 | ||
|
deacd553bf | ||
|
c8ff7e11a9 | ||
|
4cff62258c | ||
|
0144358afb | ||
|
136097efe7 | ||
|
374c6959d7 | ||
|
7d48a5ccf4 | ||
|
bf3254cb16 | ||
|
5bed3a7d52 | ||
|
ece111280b | ||
|
a15a9b956b | ||
|
42860c2f83 | ||
|
b5b95e5ae1 | ||
|
d705cffdd6 | ||
|
23a4bc103e | ||
|
c14434f9e7 | ||
|
25bd2cea3e | ||
|
532de4ecab | ||
|
bfdd27eeef | ||
|
bd9f238ab4 | ||
|
75556bb57c | ||
|
2de062a34a | ||
|
4589b15dea | ||
|
8b75ce6786 | ||
|
7bbc5176a1 | ||
|
5cb35485f1 | ||
|
80189ed689 | ||
|
3d7e8ef432 | ||
|
1999c7103c | ||
|
9c20ae383e | ||
|
76c41eaf05 | ||
|
873aa6700f | ||
|
0d9590a9a0 | ||
|
94607b585a | ||
|
da0b0348a2 | ||
|
09263455b5 | ||
|
ddc23493d4 | ||
|
54a71fc142 | ||
|
b1a9bf10a2 | ||
|
97cfbe1b63 | ||
|
0ee8c63551 | ||
|
0ac5a9ad82 | ||
|
6e51f2d608 | ||
|
f23a8dc9dc | ||
|
d09fe6178c | ||
|
ae2cfcc4f3 | ||
|
853cc65e32 | ||
|
5d140d949f | ||
|
6d2da2b3ba | ||
|
165e337e44 | ||
|
b154cd0418 | ||
|
8ef1532691 | ||
|
771e44f2a7 | ||
|
8933f1128d | ||
|
dbac4b9a63 | ||
|
bdac5b5807 | ||
|
b0961b5213 | ||
|
0d7c3fc4d8 | ||
|
8dac256096 | ||
|
8320da39c3 | ||
|
875937e3d8 | ||
|
f880adbaac | ||
|
48c5f86adb | ||
|
f60f7dab12 | ||
|
8f690236ed | ||
|
430a4297aa | ||
|
69e3ab02c4 | ||
|
b87a20b881 | ||
|
0e6f2d16ab | ||
|
498b061819 | ||
|
5ab6f599fb | ||
|
8b80626035 | ||
|
f86ae79fdb | ||
|
1a4e68096f | ||
|
d599d1f29e | ||
|
73edfb3d2c | ||
|
ebae68d579 | ||
|
573836e2b8 | ||
|
da5deb8177 | ||
|
8fca89e876 | ||
|
d5295a2d0c | ||
|
c4df115948 | ||
|
8afcb16d8e | ||
|
3764d63244 | ||
|
c82914df30 | ||
|
84ba921f5b | ||
|
8e74668e3c | ||
|
707c05b5f5 | ||
|
9bd2cec199 | ||
|
358b8fe8b6 | ||
|
7115ae5375 | ||
|
13997ca653 | ||
|
9fa04a0b93 | ||
|
0894145284 | ||
|
927b77700d | ||
|
1d7a0ea99e | ||
|
d6aee8e5ba | ||
|
dfaa39fa5d | ||
|
8fe3b59efe | ||
|
47237b1f15 | ||
|
053e727bd5 | ||
|
2ce9e81d80 | ||
|
50848ee462 | ||
|
ef06d560cd | ||
|
2abf9f96c7 | ||
|
a91686b4cd | ||
|
1be424cd47 | ||
|
929ea10f76 | ||
|
11d1f39e3d | ||
|
fc233ed4ff | ||
|
efd2e893cf | ||
|
2a18b9a8f7 | ||
|
6aa214181b | ||
|
7067beda99 | ||
|
e0f0baf164 | ||
|
1fec132dee | ||
|
ba521fccb4 | ||
|
965a97105e | ||
|
3c88c84998 | ||
|
d0f66c3734 | ||
|
ebc2a741f6 | ||
|
d46512af1c | ||
|
b4d72bd544 | ||
|
382d476271 | ||
|
80c240b54a | ||
|
21f99d88ab | ||
|
d5873a00d5 | ||
|
99076edc89 | ||
|
7b6c80327e | ||
|
57946ed672 | ||
|
aad16ac50d | ||
|
bbe897e607 | ||
|
eca0e66e23 | ||
|
3511723914 | ||
|
6a1c7b7588 | ||
|
18fd6ef119 | ||
|
0004f5d2ff | ||
|
5f29d1ba9c | ||
|
791fd35c35 | ||
|
e0d622d347 | ||
|
6b34e8a804 | ||
|
eb8773fe3e | ||
|
b40e3fa1f1 | ||
|
d25d761b55 | ||
|
d6051dd714 | ||
|
53ff061efa | ||
|
72b0efd393 | ||
|
df97ef23d9 | ||
|
f6373971bd | ||
|
ec617f2489 | ||
|
502ae78579 | ||
|
49297d6afb | ||
|
29354badd8 | ||
|
3c4de796c8 | ||
|
c7f4488e77 | ||
|
d8765f955d | ||
|
9f20037dad | ||
|
2ebb090df2 | ||
|
110fff3ab9 | ||
|
f42a1ceab7 | ||
|
9e39a7fa95 |
17
.cirrus.yml
Normal file
17
.cirrus.yml
Normal file
@ -0,0 +1,17 @@
|
||||
freebsd_instance:
|
||||
image_family: freebsd-15-0-snap
|
||||
|
||||
task:
|
||||
name: FreeBSD
|
||||
env:
|
||||
IGNORE_OSVERSION: yes
|
||||
skip_notifications: true
|
||||
prerequisites_script:
|
||||
- pkg update -f
|
||||
- pkg upgrade -y
|
||||
- pkg install -y devel/git devel/pkgconf graphics/vips www/node20 www/npm
|
||||
- pkg-config --modversion vips-cpp
|
||||
install_script:
|
||||
- npm install --build-from-source
|
||||
test_script:
|
||||
- npx mocha --no-config --spec=test/unit/io.js --timeout=30000
|
48
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
48
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
@ -12,47 +12,46 @@ New bugs are assigned a `triage` label whilst under investigation.
|
||||
|
||||
## Submit a new feature request
|
||||
|
||||
If a [similar request](https://github.com/lovell/sharp/labels/enhancement) exists, it's probably fastest to add a comment to it about your requirement.
|
||||
If a [similar request](https://github.com/lovell/sharp/labels/enhancement) exists,
|
||||
it's probably fastest to add a comment to it about your requirement.
|
||||
|
||||
Implementation is usually straightforward if _libvips_ [already supports](http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/ch03.html) the feature you need.
|
||||
Implementation is usually straightforward if libvips
|
||||
[already supports](https://www.libvips.org/API/current/func-list.html)
|
||||
the feature you need.
|
||||
|
||||
## Submit a Pull Request to fix a bug
|
||||
|
||||
Thank you! To prevent the problem occurring again, please add unit tests that would have failed.
|
||||
|
||||
Please select the `master` branch as the destination for your Pull Request so your fix can be included in the next minor release.
|
||||
Please select the `main` branch as the destination for your Pull Request so your fix can be included in the next minor release.
|
||||
|
||||
Please squash your changes into a single commit using a command like `git rebase -i upstream/master`.
|
||||
Please squash your changes into a single commit using a command like `git rebase -i upstream/main`.
|
||||
|
||||
To test C++ changes, you can compile the module using `npm install` and then run the tests using `npm test`.
|
||||
To test C++ changes, you can compile the module using `npm install --build-from-source` and then run the tests using `npm test`.
|
||||
|
||||
## Submit a Pull Request with a new feature
|
||||
|
||||
Please add JavaScript [unit tests](https://github.com/lovell/sharp/tree/master/test/unit) to cover your new feature.
|
||||
Please add JavaScript [unit tests](https://github.com/lovell/sharp/tree/main/test/unit) to cover your new feature.
|
||||
A test coverage report for the JavaScript code is generated in the `coverage/lcov-report` directory.
|
||||
Please also update the [TypeScript definitions](https://github.com/lovell/sharp/tree/main/lib/index.d.ts), along with the [type definition tests](https://github.com/lovell/sharp/tree/main/test/types/sharp.test-d.ts).
|
||||
|
||||
Where possible, the functional tests use gradient-based perceptual hashes
|
||||
based on [dHash](http://www.hackerfactor.com/blog/index.php?/archives/529-Kind-of-Like-That.html)
|
||||
to compare expected vs actual images.
|
||||
|
||||
You deserve to add your details to the [list of contributors](https://github.com/lovell/sharp/blob/master/package.json#L5).
|
||||
You deserve to add your details to the [list of contributors](https://github.com/lovell/sharp/blob/main/package.json#L5).
|
||||
|
||||
Any change that modifies the existing public API should be added to the relevant work-in-progress branch for inclusion in the next major release.
|
||||
|
||||
| Release | WIP branch |
|
||||
| ------: | :--------- |
|
||||
| v0.18.0 | ridge |
|
||||
| v0.19.0 | suit |
|
||||
|
||||
Please squash your changes into a single commit using a command like `git rebase -i upstream/<wip-branch>`.
|
||||
|
||||
### Add a new public method
|
||||
|
||||
The API tries to be as fluent as possible. Image processing concepts follow the naming conventions from _libvips_ and, to a lesser extent, _ImageMagick_.
|
||||
The API tries to be as fluent as possible.
|
||||
Image processing concepts follow the naming conventions from libvips and, to a lesser extent, ImageMagick.
|
||||
|
||||
Most methods have optional parameters and assume sensible defaults. Methods with mandatory parameters often have names like `doSomethingWith(X)`.
|
||||
|
||||
Please ensure backwards compatibility where possible. Methods to modify previously default behaviour often have names like `withoutOptionY()` or `withExtraZ()`.
|
||||
Most methods have optional parameters and assume sensible defaults.
|
||||
Please ensure backwards compatibility where possible.
|
||||
|
||||
Feel free to create a [new issue](https://github.com/lovell/sharp/issues/new) to gather feedback on a potential API change.
|
||||
|
||||
@ -60,15 +59,15 @@ Feel free to create a [new issue](https://github.com/lovell/sharp/issues/new) to
|
||||
|
||||
A method to be removed should be deprecated in the next major version then removed in the following major version.
|
||||
|
||||
By way of example, the [bilinearInterpolation method](https://github.com/lovell/sharp/blob/v0.6.0/index.js#L155) present in v0.5.0 was deprecated in v0.6.0 and removed in v0.7.0.
|
||||
By way of example, the `background()` method present in v0.20.0 was deprecated in v0.21.0 and removed in v0.22.0.
|
||||
|
||||
## Documentation
|
||||
|
||||
The public API is documented with [JSDoc](http://usejsdoc.org/) annotated comments.
|
||||
The public API is documented with [JSDoc](https://jsdoc.app/) annotated comments.
|
||||
|
||||
These can be converted to Markdown by running:
|
||||
```sh
|
||||
npm run docs
|
||||
npm run docs-build
|
||||
```
|
||||
|
||||
Please include documentation updates in any Pull Request that modifies the public API.
|
||||
@ -89,20 +88,11 @@ Requires [Valgrind](http://valgrind.org/).
|
||||
npm run test-leak
|
||||
```
|
||||
|
||||
### Packaging tests
|
||||
|
||||
Tests the installation on a number of Linux-based operating systems.
|
||||
Requires docker.
|
||||
|
||||
```sh
|
||||
npm run test-packaging
|
||||
```
|
||||
|
||||
## Finally
|
||||
|
||||
Please feel free to ask any questions via a
|
||||
[new issue](https://github.com/lovell/sharp/issues/new).
|
||||
|
||||
If you're unable to post details publicly, please
|
||||
[e-mail](https://github.com/lovell/sharp/blob/master/package.json#L4)
|
||||
[e-mail](https://github.com/lovell/sharp/blob/main/package.json#L5)
|
||||
for private, paid consulting.
|
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
open_collective: libvips
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Documentation
|
||||
url: https://sharp.pixelplumbing.com/
|
||||
about: Installation instructions, complete API documentation with examples, changelog
|
28
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
28
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea
|
||||
labels: enhancement
|
||||
|
||||
---
|
||||
|
||||
## Feature request
|
||||
|
||||
### What are you trying to achieve?
|
||||
|
||||
<!-- Please provide context here. -->
|
||||
|
||||
### When you searched for similar feature requests, what did you find that might be related?
|
||||
|
||||
<!-- Please demonstrate your research here. -->
|
||||
|
||||
### What would you expect the API to look like?
|
||||
|
||||
<!-- Please provide your suggestions here. -->
|
||||
|
||||
### What alternatives have you considered?
|
||||
|
||||
<!-- Please provide your ideas here. -->
|
||||
|
||||
### Please provide sample image(s) that help explain this feature
|
||||
|
||||
<!-- Please provide links to one or more images here. -->
|
69
.github/ISSUE_TEMPLATE/installation.md
vendored
Normal file
69
.github/ISSUE_TEMPLATE/installation.md
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
---
|
||||
name: Installation
|
||||
about: Something went wrong during either 'npm install sharp' or 'require("sharp")'
|
||||
labels: installation
|
||||
|
||||
---
|
||||
|
||||
<!-- Please try to answer as many of these questions as possible. -->
|
||||
|
||||
## Possible install-time or require-time problem
|
||||
|
||||
<!-- Please place an [x] in the box to confirm. -->
|
||||
|
||||
- [ ] 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?
|
||||
|
||||
<!-- Please place an [x] in the box to confirm. -->
|
||||
|
||||
- [ ] I am using the latest version of `sharp` as reported by `npm view sharp dist-tags.latest`.
|
||||
|
||||
If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
|
||||
|
||||
If you are using another package which depends on a version of `sharp` that is not the latest,
|
||||
please open an issue against that package instead.
|
||||
|
||||
### Are you using a supported runtime?
|
||||
|
||||
<!-- Please place an [x] in the relevant box to confirm. -->
|
||||
|
||||
- [ ] I am using Node.js with a version that satisfies `^18.17.0 || ^20.3.0 || >=21.0.0`
|
||||
- [ ] I am using Deno
|
||||
- [ ] I am using Bun
|
||||
|
||||
If you cannot confirm any of these,
|
||||
please upgrade to the latest version
|
||||
and try again before opening an issue.
|
||||
|
||||
### Are you using a supported package manager and installing optional dependencies?
|
||||
|
||||
<!-- Please place an [x] in the relevant box to confirm. -->
|
||||
|
||||
- [ ] I am using npm >= 10.1.0 with `--include=optional`
|
||||
- [ ] I am using yarn >= 3.2.0
|
||||
- [ ] I am using pnpm >= 7.1.0 with `--no-optional=false`
|
||||
- [ ] I am using Deno
|
||||
- [ ] I am using Bun
|
||||
|
||||
If you cannot confirm any of these, please upgrade to the latest version of your chosen package manager
|
||||
and ensure you are allowing the installation of optional or multi-platform dependencies before opening an issue.
|
||||
|
||||
### What is the complete error message, including the full stack trace?
|
||||
|
||||
<!-- 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?
|
||||
|
||||
<details>
|
||||
|
||||
<!-- Please provide output of `npm install --verbose --foreground-scripts sharp` in an empty directory here. -->
|
||||
|
||||
</details>
|
||||
|
||||
### What is the output of running `npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp`?
|
||||
|
||||
<!-- Please provide output of `npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp` here. -->
|
65
.github/ISSUE_TEMPLATE/possible-bug.md
vendored
Normal file
65
.github/ISSUE_TEMPLATE/possible-bug.md
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
---
|
||||
name: Possible bug
|
||||
about: Installation of sharp was successful but then something unexpected occurred using one of its features
|
||||
labels: triage
|
||||
|
||||
---
|
||||
|
||||
<!-- If this issue relates to installation, please use https://github.com/lovell/sharp/issues/new?labels=installation&template=installation.md instead. -->
|
||||
|
||||
## Possible bug
|
||||
|
||||
### Is this a possible bug in a feature of sharp, unrelated to installation?
|
||||
|
||||
<!-- Please place an [x] in the box to confirm. -->
|
||||
|
||||
- [ ] Running `npm install sharp` completes without error.
|
||||
- [ ] Running `node -e "require('sharp')"` completes without error.
|
||||
|
||||
If you cannot confirm both of these, please open an [installation issue](https://github.com/lovell/sharp/issues/new?labels=installation&template=installation.md) instead.
|
||||
|
||||
### Are you using the latest version of sharp?
|
||||
|
||||
<!-- Please place an [x] in the box to confirm. -->
|
||||
|
||||
- [ ] I am using the latest version of `sharp` as reported by `npm view sharp dist-tags.latest`.
|
||||
|
||||
If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
|
||||
|
||||
If you are using another package which depends on a version of `sharp` that is not the latest, please open an issue against that package instead.
|
||||
|
||||
### What is the output of running `npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp`?
|
||||
|
||||
<!-- 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?
|
||||
|
||||
<!-- Please enter steps to reproduce here. -->
|
||||
|
||||
### What is the expected behaviour?
|
||||
|
||||
<!-- Please enter the expected behaviour here. -->
|
||||
|
||||
### Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
|
||||
|
||||
<!-- Please provide either formatted code or a link to a repo/gist that allows someone else to reproduce here. -->
|
||||
|
||||
### Please provide sample image(s) that help explain this problem
|
||||
|
||||
<!-- Please provide links to one or more images here. -->
|
26
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
26
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
name: Question
|
||||
about: For help understanding an existing feature
|
||||
labels: question
|
||||
|
||||
---
|
||||
|
||||
<!-- If this issue relates to installation, please use https://github.com/lovell/sharp/issues/new?labels=installation&template=installation.md instead. -->
|
||||
|
||||
## Question about an existing feature
|
||||
|
||||
### What are you trying to achieve?
|
||||
|
||||
<!-- Please provide context here. -->
|
||||
|
||||
### When you searched for similar issues, what did you find that might be related?
|
||||
|
||||
<!-- Please demonstrate your research here. -->
|
||||
|
||||
### Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question
|
||||
|
||||
<!-- Please provide either formatted code or a link to a repo/gist that helps someone else understand here. -->
|
||||
|
||||
### Please provide sample image(s) that help explain this question
|
||||
|
||||
<!-- Please provide links to one or more images here. -->
|
18
.github/SECURITY.md
vendored
Normal file
18
.github/SECURITY.md
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
The latest version of `sharp` as published to npm
|
||||
and reported by `npm view sharp dist-tags.latest`
|
||||
is supported with security updates.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please use
|
||||
[e-mail](https://github.com/lovell/sharp/blob/main/package.json#L5)
|
||||
to report a vulnerability.
|
||||
|
||||
You can expect a response within 48 hours
|
||||
if you are a human reporting a genuine issue.
|
||||
|
||||
Thank you in advance.
|
330
.github/workflows/ci.yml
vendored
Normal file
330
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,330 @@
|
||||
name: CI
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
permissions: {}
|
||||
jobs:
|
||||
build-native:
|
||||
permissions:
|
||||
contents: read
|
||||
name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
|
||||
runs-on: ${{ matrix.os }}
|
||||
container: ${{ matrix.container }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-24.04
|
||||
container: rockylinux:8
|
||||
nodejs_arch: x64
|
||||
nodejs_version: "^18.17.0"
|
||||
nodejs_version_major: 18
|
||||
platform: linux-x64
|
||||
package: true
|
||||
- os: ubuntu-24.04
|
||||
container: rockylinux:8
|
||||
nodejs_arch: x64
|
||||
nodejs_version: "^20.3.0"
|
||||
nodejs_version_major: 20
|
||||
platform: linux-x64
|
||||
- os: ubuntu-24.04
|
||||
container: rockylinux:8
|
||||
nodejs_arch: x64
|
||||
nodejs_version: "^22.9.0"
|
||||
nodejs_version_major: 22
|
||||
platform: linux-x64
|
||||
- os: ubuntu-24.04
|
||||
container: node:18-alpine3.17
|
||||
nodejs_version_major: 18
|
||||
platform: linuxmusl-x64
|
||||
package: true
|
||||
- os: ubuntu-24.04
|
||||
container: node:20-alpine3.18
|
||||
nodejs_version_major: 20
|
||||
platform: linuxmusl-x64
|
||||
- os: ubuntu-24.04
|
||||
container: node:22-alpine3.20
|
||||
nodejs_version_major: 22
|
||||
platform: linuxmusl-x64
|
||||
- os: ubuntu-24.04-arm
|
||||
container: arm64v8/rockylinux:8
|
||||
nodejs_arch: arm64
|
||||
nodejs_version: "^18.17.0"
|
||||
nodejs_version_major: 18
|
||||
platform: linux-arm64
|
||||
package: true
|
||||
- os: ubuntu-24.04-arm
|
||||
container: arm64v8/rockylinux:8
|
||||
nodejs_arch: arm64
|
||||
nodejs_version: "^20.3.0"
|
||||
nodejs_version_major: 20
|
||||
platform: linux-arm64
|
||||
- os: macos-13
|
||||
nodejs_arch: x64
|
||||
nodejs_version: "^18.17.0"
|
||||
nodejs_version_major: 18
|
||||
platform: darwin-x64
|
||||
package: true
|
||||
- os: macos-13
|
||||
nodejs_arch: x64
|
||||
nodejs_version: "^20.3.0"
|
||||
nodejs_version_major: 20
|
||||
platform: darwin-x64
|
||||
- os: macos-13
|
||||
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_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
|
||||
package: true
|
||||
- os: windows-2022
|
||||
nodejs_arch: x86
|
||||
nodejs_version: "^20.3.0"
|
||||
nodejs_version_major: 20
|
||||
platform: win32-ia32
|
||||
- os: windows-2022
|
||||
nodejs_arch: x86
|
||||
nodejs_version: "^22.9.0"
|
||||
nodejs_version_major: 22
|
||||
platform: win32-ia32
|
||||
- os: windows-2022
|
||||
nodejs_arch: x64
|
||||
nodejs_version: "^18.17.0"
|
||||
nodejs_version_major: 18
|
||||
platform: win32-x64
|
||||
package: true
|
||||
- os: windows-2022
|
||||
nodejs_arch: x64
|
||||
nodejs_version: "^20.3.0"
|
||||
nodejs_version_major: 20
|
||||
platform: win32-x64
|
||||
- os: windows-2022
|
||||
nodejs_arch: x64
|
||||
nodejs_version: "^22.9.0"
|
||||
nodejs_version_major: 22
|
||||
platform: win32-x64
|
||||
- os: windows-11-arm
|
||||
nodejs_arch: arm64
|
||||
nodejs_version: "^20.3.0"
|
||||
nodejs_version_major: 20
|
||||
platform: win32-arm64
|
||||
package: true
|
||||
- os: windows-11-arm
|
||||
nodejs_arch: arm64
|
||||
nodejs_version: "^22.9.0"
|
||||
nodejs_version_major: 22
|
||||
platform: win32-arm64
|
||||
steps:
|
||||
- name: Dependencies (Rocky Linux glibc)
|
||||
if: contains(matrix.container, 'rockylinux')
|
||||
run: |
|
||||
dnf install -y gcc-toolset-14-gcc-c++ make git python3.12 fontconfig google-noto-sans-fonts
|
||||
echo "/opt/rh/gcc-toolset-14/root/usr/bin" >> $GITHUB_PATH
|
||||
- name: Dependencies (Linux musl)
|
||||
if: contains(matrix.container, 'alpine')
|
||||
run: apk add build-base git python3 font-noto --update-cache
|
||||
- name: Dependencies (Python 3.11 - macOS, Windows)
|
||||
if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows')
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: Dependencies (Node.js)
|
||||
if: "!contains(matrix.platform, 'linuxmusl')"
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.nodejs_version }}
|
||||
architecture: ${{ matrix.nodejs_arch }}
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install
|
||||
run: npm install --build-from-source
|
||||
- name: Test
|
||||
run: npm test
|
||||
- name: Populate npm package
|
||||
if: matrix.package
|
||||
run: npm run package-from-local-build
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: matrix.package
|
||||
with:
|
||||
name: ${{ matrix.platform }}
|
||||
path: npm/${{ matrix.platform }}
|
||||
retention-days: 1
|
||||
if-no-files-found: error
|
||||
build-linuxmusl-arm64:
|
||||
permissions:
|
||||
contents: read
|
||||
name: "build-linuxmusl-arm64 [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
|
||||
runs-on: ubuntu-24.04-arm
|
||||
container:
|
||||
image: ${{ matrix.container }}
|
||||
volumes:
|
||||
- /opt:/opt:rw,rshared
|
||||
- /opt:/__e/node20:ro,rshared
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- container: node:18-alpine3.17
|
||||
nodejs_version_major: 18
|
||||
package: true
|
||||
- container: node:20-alpine3.18
|
||||
nodejs_version_major: 20
|
||||
steps:
|
||||
- name: Allow Linux musl containers on ARM64 runners # https://github.com/actions/runner/issues/801#issuecomment-2394425757
|
||||
shell: sh
|
||||
run: |
|
||||
sed -i "/^ID=/s/alpine/NotpineForGHA/" /etc/os-release
|
||||
apk add nodejs --update-cache
|
||||
mkdir /opt/bin
|
||||
ln -s /usr/bin/node /opt/bin/node
|
||||
- name: Dependencies
|
||||
run: apk add build-base git python3 font-noto --update-cache
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install
|
||||
run: npm install --build-from-source
|
||||
- name: Test
|
||||
run: npm test
|
||||
- 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: |
|
||||
EMSCRIPTEN_VERSION_LIBVIPS=$(node -p "require('@img/sharp-libvips-dev-wasm32/versions').emscripten")
|
||||
EMSCRIPTEN_VERSION_SHARP=$(emcc -dumpversion)
|
||||
echo "libvips built with emscripten $EMSCRIPTEN_VERSION_LIBVIPS"
|
||||
echo "sharp built with emscripten $EMSCRIPTEN_VERSION_SHARP"
|
||||
test "$EMSCRIPTEN_VERSION_LIBVIPS" = "$EMSCRIPTEN_VERSION_SHARP"
|
||||
- name: Test
|
||||
run: emmake npm test
|
||||
- name: Populate npm package
|
||||
run: emmake npm run package-from-local-build
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wasm32
|
||||
path: npm/wasm32
|
||||
retention-days: 1
|
||||
if-no-files-found: error
|
||||
release:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-24.04
|
||||
needs:
|
||||
- build-native
|
||||
- build-linuxmusl-arm64
|
||||
- build-qemu
|
||||
- build-emscripten
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: npm
|
||||
- name: Create npm workspace tarball
|
||||
run: tar -vcaf npm-workspace.tar.xz --directory npm --exclude=from-local-build.js .
|
||||
- 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
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
|
22
.gitignore
vendored
22
.gitignore
vendored
@ -1,16 +1,18 @@
|
||||
build
|
||||
src/build
|
||||
src/node_modules
|
||||
node_modules
|
||||
coverage
|
||||
/coverage
|
||||
npm/*/*
|
||||
!npm/*/package.json
|
||||
test/bench/node_modules
|
||||
test/fixtures/output*
|
||||
test/fixtures/vips-properties.xml
|
||||
test/leak/libvips.supp
|
||||
test/saliency/report.json
|
||||
test/saliency/Image*
|
||||
test/saliency/[Uu]serData*
|
||||
!test/saliency/userData.js
|
||||
vendor
|
||||
packaging/libvips*
|
||||
packaging/*.log
|
||||
!packaging/build
|
||||
.DS_Store
|
||||
.nyc_output
|
||||
.vscode/
|
||||
package-lock.json
|
||||
.idea
|
||||
.firebase
|
||||
.astro
|
||||
docs/dist
|
||||
|
7
.mocharc.jsonc
Normal file
7
.mocharc.jsonc
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"parallel": true,
|
||||
"slow": 1000,
|
||||
"timeout": 30000,
|
||||
"require": "./test/beforeEach.js",
|
||||
"spec": "./test/unit/*.js"
|
||||
}
|
14
.npmignore
14
.npmignore
@ -1,14 +0,0 @@
|
||||
build
|
||||
node_modules
|
||||
coverage
|
||||
.editorconfig
|
||||
.gitignore
|
||||
test
|
||||
.travis.yml
|
||||
appveyor.yml
|
||||
circle.yml
|
||||
mkdocs.yml
|
||||
vendor
|
||||
packaging
|
||||
preinstall.sh
|
||||
.nyc_output
|
21
.travis.yml
21
.travis.yml
@ -1,21 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4"
|
||||
- "6"
|
||||
- "7"
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.8
|
||||
osx_image: xcode8
|
||||
before_install:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CXX=g++-4.8; fi
|
||||
after_success:
|
||||
- npm install coveralls
|
||||
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
90
README.md
90
README.md
@ -1,15 +1,18 @@
|
||||
# sharp
|
||||
|
||||
```sh
|
||||
npm install sharp
|
||||
```
|
||||
<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
|
||||
smaller, web-friendly JPEG, PNG and WebP images of varying dimensions.
|
||||
smaller, web-friendly JPEG, PNG, WebP, GIF and AVIF images of varying dimensions.
|
||||
|
||||
It can be used with all JavaScript runtimes
|
||||
that provide support for Node-API v9, including
|
||||
Node.js (^18.17.0 or >= 20.3.0), Deno and Bun.
|
||||
|
||||
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).
|
||||
|
||||
Colour spaces, embedded ICC profiles and alpha transparency channels are all handled correctly.
|
||||
Lanczos resampling ensures quality is not sacrificed for speed.
|
||||
@ -17,39 +20,76 @@ Lanczos resampling ensures quality is not sacrificed for speed.
|
||||
As well as image resizing, operations such as
|
||||
rotation, extraction, compositing and gamma correction are available.
|
||||
|
||||
OS X, Windows (x64), Linux (x64, ARM) systems do not require
|
||||
the installation of any external runtime dependencies.
|
||||
Most modern macOS, Windows and Linux systems
|
||||
do not require any additional install or runtime dependencies.
|
||||
|
||||
## Documentation
|
||||
|
||||
Visit [sharp.pixelplumbing.com](https://sharp.pixelplumbing.com/) for complete
|
||||
[installation instructions](https://sharp.pixelplumbing.com/install),
|
||||
[API documentation](https://sharp.pixelplumbing.com/api-constructor),
|
||||
[benchmark tests](https://sharp.pixelplumbing.com/performance) and
|
||||
[changelog](https://sharp.pixelplumbing.com/changelog).
|
||||
|
||||
## Examples
|
||||
|
||||
```javascript
|
||||
import sharp from 'sharp';
|
||||
```sh
|
||||
npm install sharp
|
||||
```
|
||||
|
||||
```javascript
|
||||
const sharp = require('sharp');
|
||||
```
|
||||
|
||||
### Callback
|
||||
|
||||
```javascript
|
||||
sharp(inputBuffer)
|
||||
.resize(320, 240)
|
||||
.toFile('output.webp', (err, info) => ... );
|
||||
.toFile('output.webp', (err, info) => { ... });
|
||||
```
|
||||
|
||||
### Promise
|
||||
|
||||
```javascript
|
||||
sharp('input.jpg')
|
||||
.rotate()
|
||||
.resize(200)
|
||||
.jpeg({ mozjpeg: true })
|
||||
.toBuffer()
|
||||
.then( data => ... )
|
||||
.catch( err => ... );
|
||||
.then( data => { ... })
|
||||
.catch( err => { ... });
|
||||
```
|
||||
|
||||
### Async/await
|
||||
|
||||
```javascript
|
||||
const roundedCorners = new Buffer(
|
||||
const semiTransparentRedPng = await sharp({
|
||||
create: {
|
||||
width: 48,
|
||||
height: 48,
|
||||
channels: 4,
|
||||
background: { r: 255, g: 0, b: 0, alpha: 0.5 }
|
||||
}
|
||||
})
|
||||
.png()
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
### Stream
|
||||
|
||||
```javascript
|
||||
const roundedCorners = Buffer.from(
|
||||
'<svg><rect x="0" y="0" width="200" height="200" rx="50" ry="50"/></svg>'
|
||||
);
|
||||
|
||||
const roundedCornerResizer =
|
||||
sharp()
|
||||
.resize(200, 200)
|
||||
.overlayWith(roundedCorners, { cutout: true })
|
||||
.composite([{
|
||||
input: roundedCorners,
|
||||
blend: 'dest-in'
|
||||
}])
|
||||
.png();
|
||||
|
||||
readableStream
|
||||
@ -57,29 +97,19 @@ readableStream
|
||||
.pipe(writableStream);
|
||||
```
|
||||
|
||||
[](https://coveralls.io/r/lovell/sharp?branch=master)
|
||||
## Contributing
|
||||
|
||||
### Documentation
|
||||
|
||||
Visit [sharp.dimens.io](http://sharp.dimens.io/) for complete
|
||||
[installation instructions](http://sharp.dimens.io/page/install),
|
||||
[API documentation](http://sharp.dimens.io/page/api),
|
||||
[benchmark tests](http://sharp.dimens.io/page/performance) and
|
||||
[changelog](http://sharp.dimens.io/page/changelog).
|
||||
|
||||
### Contributing
|
||||
|
||||
A [guide for contributors](https://github.com/lovell/sharp/blob/master/CONTRIBUTING.md)
|
||||
A [guide for contributors](https://github.com/lovell/sharp/blob/main/.github/CONTRIBUTING.md)
|
||||
covers reporting bugs, requesting features and submitting code changes.
|
||||
|
||||
### Licence
|
||||
## Licensing
|
||||
|
||||
Copyright 2013, 2014, 2015, 2016, 2017 Lovell Fuller and contributors.
|
||||
Copyright 2013 Lovell Fuller and others.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
|
||||
[https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
15
appveyor.yml
15
appveyor.yml
@ -1,15 +0,0 @@
|
||||
os: Visual Studio 2015
|
||||
version: "{build}"
|
||||
build: off
|
||||
platform: x64
|
||||
environment:
|
||||
matrix:
|
||||
- nodejs_version: "4"
|
||||
- nodejs_version: "6"
|
||||
- nodejs_version: "7"
|
||||
install:
|
||||
- ps: Install-Product node $env:nodejs_version x64
|
||||
- npm install -g npm@latest
|
||||
- npm install
|
||||
test_script:
|
||||
- npm test
|
278
binding.gyp
278
binding.gyp
@ -1,278 +0,0 @@
|
||||
{
|
||||
'targets': [{
|
||||
'target_name': 'libvips-cpp',
|
||||
'conditions': [
|
||||
['OS == "win"', {
|
||||
# Build libvips C++ binding for Windows due to MSVC std library ABI changes
|
||||
'type': 'shared_library',
|
||||
'variables': {
|
||||
'download_vips': '<!(node -e "require(\'./binding\').download_vips()")'
|
||||
},
|
||||
'defines': [
|
||||
'VIPS_CPLUSPLUS_EXPORTS',
|
||||
'_ALLOW_KEYWORD_MACROS'
|
||||
],
|
||||
'sources': [
|
||||
'src/libvips/cplusplus/VError.cpp',
|
||||
'src/libvips/cplusplus/VInterpolate.cpp',
|
||||
'src/libvips/cplusplus/VImage.cpp'
|
||||
],
|
||||
'include_dirs': [
|
||||
'vendor/include',
|
||||
'vendor/include/glib-2.0',
|
||||
'vendor/lib/glib-2.0/include'
|
||||
],
|
||||
'libraries': [
|
||||
'../vendor/lib/libvips.lib',
|
||||
'../vendor/lib/libglib-2.0.lib',
|
||||
'../vendor/lib/libgobject-2.0.lib'
|
||||
],
|
||||
'configurations': {
|
||||
'Release': {
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'ExceptionHandling': 1
|
||||
}
|
||||
},
|
||||
'msvs_disabled_warnings': [
|
||||
4275
|
||||
]
|
||||
}
|
||||
}
|
||||
}, {
|
||||
# Ignore this target for non-Windows
|
||||
'type': 'none'
|
||||
}]
|
||||
]
|
||||
}, {
|
||||
'target_name': 'sharp',
|
||||
'dependencies': [
|
||||
'libvips-cpp'
|
||||
],
|
||||
# Nested variables "pattern" borrowed from http://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi
|
||||
'variables': {
|
||||
'variables': {
|
||||
'variables': {
|
||||
'conditions': [
|
||||
['OS != "win"', {
|
||||
# Build the PKG_CONFIG_PATH environment variable with all possible combinations
|
||||
'pkg_config_path': '<!(which brew >/dev/null 2>&1 && eval $(brew --env) && echo $PKG_CONFIG_LIBDIR || true):$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig'
|
||||
}, {
|
||||
'pkg_config_path': ''
|
||||
}]
|
||||
],
|
||||
},
|
||||
'conditions': [
|
||||
['OS != "win"', {
|
||||
# Which version, if any, of libvips is available globally via pkg-config?
|
||||
'global_vips_version': '<!(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --modversion vips-cpp 2>/dev/null || true)'
|
||||
}, {
|
||||
'global_vips_version': ''
|
||||
}]
|
||||
],
|
||||
'pkg_config_path%': '<(pkg_config_path)'
|
||||
},
|
||||
'pkg_config_path%': '<(pkg_config_path)',
|
||||
'runtime_link%': 'shared',
|
||||
'conditions': [
|
||||
['OS != "win"', {
|
||||
# Does the globally available version of libvips, if any, meet the minimum version requirement?
|
||||
'use_global_vips': '<!(GLOBAL_VIPS_VERSION="<(global_vips_version)" node -e "require(\'./binding\').use_global_vips()")'
|
||||
}, {
|
||||
'use_global_vips': ''
|
||||
}]
|
||||
]
|
||||
},
|
||||
'sources': [
|
||||
'src/common.cc',
|
||||
'src/metadata.cc',
|
||||
'src/operations.cc',
|
||||
'src/pipeline.cc',
|
||||
'src/sharp.cc',
|
||||
'src/utilities.cc'
|
||||
],
|
||||
'include_dirs': [
|
||||
'<!(node -e "require(\'nan\')")'
|
||||
],
|
||||
'conditions': [
|
||||
['use_global_vips == "true"', {
|
||||
# Use pkg-config for include and lib
|
||||
'include_dirs': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --cflags-only-I vips-cpp vips glib-2.0 | sed s\/-I//g)'],
|
||||
'conditions': [
|
||||
['runtime_link == "static"', {
|
||||
'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs --static vips-cpp)']
|
||||
}, {
|
||||
'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips-cpp)']
|
||||
}],
|
||||
['OS == "linux"', {
|
||||
'defines': [
|
||||
# Inspect libvips-cpp.so to determine which C++11 ABI version was used and set _GLIBCXX_USE_CXX11_ABI accordingly. This is quite horrible.
|
||||
'_GLIBCXX_USE_CXX11_ABI=<!(if readelf -Ws "$(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --variable libdir vips-cpp)/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi)'
|
||||
]
|
||||
}]
|
||||
]
|
||||
}, {
|
||||
# Attempt to download pre-built libvips and install locally within node_modules
|
||||
'include_dirs': [
|
||||
'vendor/include',
|
||||
'vendor/include/glib-2.0',
|
||||
'vendor/lib/glib-2.0/include'
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "win"', {
|
||||
'defines': [
|
||||
'_ALLOW_KEYWORD_MACROS'
|
||||
],
|
||||
'libraries': [
|
||||
'../vendor/lib/libvips.lib',
|
||||
'../vendor/lib/libglib-2.0.lib',
|
||||
'../vendor/lib/libgobject-2.0.lib'
|
||||
]
|
||||
}],
|
||||
['OS == "mac"', {
|
||||
'variables': {
|
||||
'download_vips': '<!(node -e "require(\'./binding\').download_vips()")'
|
||||
},
|
||||
'libraries': [
|
||||
'../vendor/lib/libvips-cpp.42.dylib',
|
||||
'../vendor/lib/libvips.42.dylib',
|
||||
'../vendor/lib/libglib-2.0.0.dylib',
|
||||
'../vendor/lib/libgobject-2.0.0.dylib',
|
||||
# Ensure runtime linking is relative to sharp.node
|
||||
'-rpath \'@loader_path/../../vendor/lib\''
|
||||
]
|
||||
}],
|
||||
['OS == "linux"', {
|
||||
'variables': {
|
||||
'download_vips': '<!(LDD_VERSION="<!(ldd --version 2>&1 || true)" node -e "require(\'./binding\').download_vips()")'
|
||||
},
|
||||
'defines': [
|
||||
'_GLIBCXX_USE_CXX11_ABI=0'
|
||||
],
|
||||
'libraries': [
|
||||
'../vendor/lib/libvips-cpp.so',
|
||||
'../vendor/lib/libvips.so',
|
||||
'../vendor/lib/libglib-2.0.so',
|
||||
'../vendor/lib/libgobject-2.0.so',
|
||||
# Dependencies of dependencies, included for openSUSE support
|
||||
'../vendor/lib/libcairo.so',
|
||||
'../vendor/lib/libcroco-0.6.so',
|
||||
'../vendor/lib/libexif.so',
|
||||
'../vendor/lib/libffi.so',
|
||||
'../vendor/lib/libfontconfig.so',
|
||||
'../vendor/lib/libfreetype.so',
|
||||
'../vendor/lib/libgdk_pixbuf-2.0.so',
|
||||
'../vendor/lib/libgif.so',
|
||||
'../vendor/lib/libgio-2.0.so',
|
||||
'../vendor/lib/libgmodule-2.0.so',
|
||||
'../vendor/lib/libgsf-1.so',
|
||||
'../vendor/lib/libgthread-2.0.so',
|
||||
'../vendor/lib/libharfbuzz.so',
|
||||
'../vendor/lib/libjpeg.so',
|
||||
'../vendor/lib/liblcms2.so',
|
||||
'../vendor/lib/liborc-0.4.so',
|
||||
'../vendor/lib/libpango-1.0.so',
|
||||
'../vendor/lib/libpangocairo-1.0.so',
|
||||
'../vendor/lib/libpangoft2-1.0.so',
|
||||
'../vendor/lib/libpixman-1.so',
|
||||
'../vendor/lib/libpng.so',
|
||||
'../vendor/lib/librsvg-2.so',
|
||||
'../vendor/lib/libtiff.so',
|
||||
'../vendor/lib/libwebp.so',
|
||||
'../vendor/lib/libxml2.so',
|
||||
'../vendor/lib/libz.so',
|
||||
# Ensure runtime linking is relative to sharp.node
|
||||
'-Wl,--disable-new-dtags -Wl,-rpath=\'$${ORIGIN}/../../vendor/lib\''
|
||||
]
|
||||
}]
|
||||
]
|
||||
}]
|
||||
],
|
||||
'cflags_cc': [
|
||||
'-std=c++0x',
|
||||
'-fexceptions',
|
||||
'-Wall',
|
||||
'-O3'
|
||||
],
|
||||
'xcode_settings': {
|
||||
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
|
||||
'CLANG_CXX_LIBRARY': 'libc++',
|
||||
'MACOSX_DEPLOYMENT_TARGET': '10.7',
|
||||
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
|
||||
'GCC_ENABLE_CPP_RTTI': 'YES',
|
||||
'OTHER_CPLUSPLUSFLAGS': [
|
||||
'-fexceptions',
|
||||
'-Wall',
|
||||
'-O3'
|
||||
]
|
||||
},
|
||||
'configurations': {
|
||||
'Release': {
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'ExceptionHandling': 1
|
||||
}
|
||||
},
|
||||
'msvs_disabled_warnings': [
|
||||
4275
|
||||
]
|
||||
}
|
||||
},
|
||||
}, {
|
||||
'target_name': 'win_copy_dlls',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'sharp'
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "win"', {
|
||||
# Windows lacks support for rpath
|
||||
'copies': [{
|
||||
'destination': 'build/Release',
|
||||
'files': [
|
||||
'vendor/lib/GNU.Gettext.dll',
|
||||
'vendor/lib/libasprintf-0.dll',
|
||||
'vendor/lib/libcairo-2.dll',
|
||||
'vendor/lib/libcairo-gobject-2.dll',
|
||||
'vendor/lib/libcairo-script-interpreter-2.dll',
|
||||
'vendor/lib/libcharset-1.dll',
|
||||
'vendor/lib/libcroco-0.6-3.dll',
|
||||
'vendor/lib/libexif-12.dll',
|
||||
'vendor/lib/libexpat-1.dll',
|
||||
'vendor/lib/libffi-6.dll',
|
||||
'vendor/lib/libfftw3-3.dll',
|
||||
'vendor/lib/libfontconfig-1.dll',
|
||||
'vendor/lib/libfreetype-6.dll',
|
||||
'vendor/lib/libgcc_s_seh-1.dll',
|
||||
'vendor/lib/libgdk_pixbuf-2.0-0.dll',
|
||||
'vendor/lib/libgif-7.dll',
|
||||
'vendor/lib/libgio-2.0-0.dll',
|
||||
'vendor/lib/libglib-2.0-0.dll',
|
||||
'vendor/lib/libgmodule-2.0-0.dll',
|
||||
'vendor/lib/libgobject-2.0-0.dll',
|
||||
'vendor/lib/libgsf-1-114.dll',
|
||||
'vendor/lib/libgthread-2.0-0.dll',
|
||||
'vendor/lib/libiconv-2.dll',
|
||||
'vendor/lib/libintl-8.dll',
|
||||
'vendor/lib/libjpeg-62.dll',
|
||||
'vendor/lib/liblcms2-2.dll',
|
||||
'vendor/lib/libpango-1.0-0.dll',
|
||||
'vendor/lib/libpangocairo-1.0-0.dll',
|
||||
'vendor/lib/libpangowin32-1.0-0.dll',
|
||||
'vendor/lib/libpixman-1-0.dll',
|
||||
'vendor/lib/libpng16-16.dll',
|
||||
'vendor/lib/libquadmath-0.dll',
|
||||
'vendor/lib/librsvg-2-2.dll',
|
||||
'vendor/lib/libssp-0.dll',
|
||||
'vendor/lib/libstdc++-6.dll',
|
||||
'vendor/lib/libtiff-5.dll',
|
||||
'vendor/lib/libvips-42.dll',
|
||||
'vendor/lib/libwebp-7.dll',
|
||||
'vendor/lib/libxml2-2.dll',
|
||||
'vendor/lib/zlib1.dll'
|
||||
]
|
||||
}]
|
||||
}]
|
||||
]
|
||||
}]
|
||||
}
|
129
binding.js
129
binding.js
@ -1,129 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
|
||||
const caw = require('caw');
|
||||
const got = require('got');
|
||||
const semver = require('semver');
|
||||
const tar = require('tar');
|
||||
|
||||
const distBaseUrl = 'https://dl.bintray.com/lovell/sharp/';
|
||||
|
||||
// Use NPM-provided environment variable where available, falling back to require-based method for Electron
|
||||
const minimumLibvipsVersion = process.env.npm_package_config_libvips || require('./package.json').config.libvips;
|
||||
|
||||
const platform = process.env.npm_config_platform || process.platform;
|
||||
|
||||
const arch = process.env.npm_config_arch || process.arch;
|
||||
|
||||
// -- Helpers
|
||||
|
||||
// Does this file exist?
|
||||
const isFile = function (file) {
|
||||
try {
|
||||
return fs.statSync(file).isFile();
|
||||
} catch (err) {}
|
||||
};
|
||||
|
||||
const unpack = function (tarPath, done) {
|
||||
const vendorPath = path.join(__dirname, 'vendor');
|
||||
fs.mkdirSync(vendorPath);
|
||||
tar
|
||||
.extract({
|
||||
file: tarPath,
|
||||
cwd: vendorPath,
|
||||
strict: true
|
||||
})
|
||||
.then(done)
|
||||
.catch(error);
|
||||
};
|
||||
|
||||
const platformId = function () {
|
||||
const platformId = [platform];
|
||||
if (arch === 'arm' || arch === 'armhf' || arch === 'arm64') {
|
||||
const armVersion = (arch === 'arm64') ? '8' : process.env.npm_config_armv || process.config.variables.arm_version || '6';
|
||||
platformId.push('armv' + armVersion);
|
||||
} else {
|
||||
platformId.push(arch);
|
||||
}
|
||||
return platformId.join('-');
|
||||
};
|
||||
|
||||
// Error
|
||||
const error = function (msg) {
|
||||
if (msg instanceof Error) {
|
||||
msg = msg.message;
|
||||
}
|
||||
process.stderr.write('ERROR: ' + msg + '\n');
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
// -- Binary downloaders
|
||||
|
||||
module.exports.download_vips = function () {
|
||||
// Has vips been installed locally?
|
||||
const vipsHeaderPath = path.join(__dirname, 'vendor', 'include', 'vips', 'vips.h');
|
||||
if (!isFile(vipsHeaderPath)) {
|
||||
// Ensure Intel 64-bit or ARM
|
||||
if (arch === 'ia32') {
|
||||
error('Intel Architecture 32-bit systems require manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
||||
}
|
||||
// Ensure glibc >= 2.15
|
||||
const lddVersion = process.env.LDD_VERSION;
|
||||
if (lddVersion) {
|
||||
if (/(glibc|gnu libc|gentoo)/i.test(lddVersion)) {
|
||||
const glibcVersion = lddVersion ? lddVersion.split(/\n/)[0].split(' ').slice(-1)[0].trim() : '';
|
||||
if (glibcVersion && semver.lt(glibcVersion + '.0', '2.13.0')) {
|
||||
error('glibc version ' + glibcVersion + ' requires manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
||||
}
|
||||
} else {
|
||||
error(lddVersion.split(/\n/)[0] + ' requires manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
||||
}
|
||||
}
|
||||
// Arch/platform-specific .tar.gz
|
||||
const tarFilename = ['libvips', minimumLibvipsVersion, platformId()].join('-') + '.tar.gz';
|
||||
const tarPathLocal = path.join(__dirname, 'packaging', tarFilename);
|
||||
if (isFile(tarPathLocal)) {
|
||||
unpack(tarPathLocal);
|
||||
} else {
|
||||
// Download to per-process temporary file
|
||||
const tarPathTemp = path.join(os.tmpdir(), process.pid + '-' + tarFilename);
|
||||
const tmpFile = fs.createWriteStream(tarPathTemp).on('finish', function () {
|
||||
unpack(tarPathTemp, function () {
|
||||
// Attempt to remove temporary file
|
||||
try {
|
||||
fs.unlinkSync(tarPathTemp);
|
||||
} catch (err) {}
|
||||
});
|
||||
});
|
||||
const gotOpt = {
|
||||
agent: caw(null, {
|
||||
protocol: 'https'
|
||||
})
|
||||
};
|
||||
const url = distBaseUrl + tarFilename;
|
||||
got.stream(url, gotOpt).on('response', function (response) {
|
||||
if (response.statusCode !== 200) {
|
||||
error(url + ' status code ' + response.statusCode);
|
||||
}
|
||||
}).on('error', function (err) {
|
||||
error('Download of ' + url + ' failed: ' + err.message);
|
||||
}).pipe(tmpFile);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.use_global_vips = function () {
|
||||
const globalVipsVersion = process.env.GLOBAL_VIPS_VERSION;
|
||||
if (globalVipsVersion) {
|
||||
const useGlobalVips = semver.gte(
|
||||
globalVipsVersion,
|
||||
minimumLibvipsVersion
|
||||
);
|
||||
process.stdout.write(useGlobalVips ? 'true' : 'false');
|
||||
} else {
|
||||
process.stdout.write('false');
|
||||
}
|
||||
};
|
@ -1,8 +0,0 @@
|
||||
machine:
|
||||
node:
|
||||
version: v4.6.1
|
||||
services:
|
||||
- docker
|
||||
test:
|
||||
override:
|
||||
- ./packaging/test-linux-x64.sh
|
@ -1,77 +0,0 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [extractChannel](#extractchannel)
|
||||
- [joinChannel](#joinchannel)
|
||||
- [bandbool](#bandbool)
|
||||
|
||||
## extractChannel
|
||||
|
||||
Extract a single channel from a multi-channel image.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `channel` **([Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) \| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))** zero-indexed band number to extract, or `red`, `green` or `blue` as alternative to `0`, `1` or `2` respectively.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.extractChannel('green')
|
||||
.toFile('input_green.jpg', function(err, info) {
|
||||
// info.channels === 1
|
||||
// input_green.jpg contains the green channel of the input image
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid channel
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## joinChannel
|
||||
|
||||
Join one or more channels to the image.
|
||||
The meaning of the added channels depends on the output colourspace, set with `toColourspace()`.
|
||||
By default the output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
||||
Channel ordering follows vips convention:
|
||||
|
||||
- sRGB: 0: Red, 1: Green, 2: Blue, 3: Alpha.
|
||||
- CMYK: 0: Magenta, 1: Cyan, 2: Yellow, 3: Black, 4: Alpha.
|
||||
|
||||
Buffers may be any of the image formats supported by sharp: JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data.
|
||||
For raw pixel input, the `options` object should contain a `raw` attribute, which follows the format of the attribute of the same name in the `sharp()` constructor.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `images` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Buffer](https://nodejs.org/api/buffer.html))> | [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Buffer](https://nodejs.org/api/buffer.html))** one or more images (file paths, Buffers).
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** image options, see `sharp()` constructor.
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## bandbool
|
||||
|
||||
Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `boolOp` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
sharp('3-channel-rgb-input.png')
|
||||
.bandbool(sharp.bool.and)
|
||||
.toFile('1-channel-output.png', function (err, info) {
|
||||
// The output will be a single channel image where each pixel `P = R & G & B`.
|
||||
// If `I(1,1) = [247, 170, 14] = [0b11110111, 0b10101010, 0b00001111]`
|
||||
// then `O(1,1) = 0b11110111 & 0b10101010 & 0b00001111 = 0b00000010 = 2`.
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
@ -1,79 +0,0 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [background](#background)
|
||||
- [greyscale](#greyscale)
|
||||
- [grayscale](#grayscale)
|
||||
- [toColourspace](#tocolourspace)
|
||||
- [toColorspace](#tocolorspace)
|
||||
|
||||
## background
|
||||
|
||||
Set the background for the `embed`, `flatten` and `extend` operations.
|
||||
The default background is `{r: 0, g: 0, b: 0, alpha: 1}`, black without transparency.
|
||||
|
||||
Delegates to the _color_ module, which can throw an Error
|
||||
but is liberal in what it accepts, clipping values to sensible min/max.
|
||||
The alpha value is a float between `0` (transparent) and `1` (opaque).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `rgba` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameter
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## greyscale
|
||||
|
||||
Convert to 8-bit greyscale; 256 shades of grey.
|
||||
This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
|
||||
By default the output image will be web-friendly sRGB and contain three (identical) color channels.
|
||||
This may be overridden by other sharp operations such as `toColourspace('b-w')`,
|
||||
which will produce an output image containing one color channel.
|
||||
An alpha channel may be present, and will be unchanged by the operation.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `greyscale` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## grayscale
|
||||
|
||||
Alternative spelling of `greyscale`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `grayscale` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## toColourspace
|
||||
|
||||
Set the output colourspace.
|
||||
By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `colourspace` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://github.com/jcupitt/libvips/blob/master/libvips/iofuncs/enumtypes.c#L568)
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## toColorspace
|
||||
|
||||
Alternative spelling of `toColourspace`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `colorspace` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** output colorspace.
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
@ -1,59 +0,0 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [overlayWith](#overlaywith)
|
||||
|
||||
## overlayWith
|
||||
|
||||
Overlay (composite) an image over the processed (resized, extracted etc.) image.
|
||||
|
||||
The overlay image 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 the overlay image contains an alpha channel then composition with premultiplication will occur.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `overlay` **([Buffer](https://nodejs.org/api/buffer.html) \| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))** Buffer containing image data or String containing the path to an image file.
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?**
|
||||
- `options.gravity` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** gravity at which to place the overlay. (optional, default `'centre'`)
|
||||
- `options.top` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** the pixel offset from the top edge.
|
||||
- `options.left` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** the pixel offset from the left edge.
|
||||
- `options.tile` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** set to true to repeat the overlay image across the entire image with the given `gravity`. (optional, default `false`)
|
||||
- `options.cutout` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** set to true to apply only the alpha channel of the overlay image to the input image, giving the appearance of one image being cut out of another. (optional, default `false`)
|
||||
- `options.density` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** integral number representing the DPI for vector overlay image. (optional, default `72`)
|
||||
- `options.raw` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** describes overlay when using raw pixel data.
|
||||
- `options.raw.width` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `options.raw.height` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `options.raw.channels` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `options.create` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** describes a blank overlay to be created.
|
||||
- `options.create.width` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `options.create.height` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `options.create.channels` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** 3-4
|
||||
- `options.create.background` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))?** parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
sharp('input.png')
|
||||
.rotate(180)
|
||||
.resize(300)
|
||||
.flatten()
|
||||
.background('#ff6600')
|
||||
.overlayWith('overlay.png', { gravity: sharp.gravity.southeast } )
|
||||
.sharpen()
|
||||
.withMetadata()
|
||||
.quality(90)
|
||||
.webp()
|
||||
.toBuffer()
|
||||
.then(function(outputBuffer) {
|
||||
// outputBuffer contains upside down, 300px wide, alpha channel flattened
|
||||
// onto orange background, composited with overlay.png with SE gravity,
|
||||
// sharpened, with metadata, 90% quality WebP image data. Phew!
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
@ -1,108 +0,0 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [Sharp](#sharp)
|
||||
- [format](#format)
|
||||
- [versions](#versions)
|
||||
- [queue](#queue)
|
||||
|
||||
## Sharp
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `input` **([Buffer](https://nodejs.org/api/buffer.html) \| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))?** if present, can be
|
||||
a Buffer containing JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data, or
|
||||
a String containing the path to an JPEG, PNG, WebP, GIF, SVG or TIFF image file.
|
||||
JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present.
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** if present, is an Object with optional attributes.
|
||||
- `options.density` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** integral number representing the DPI for vector images. (optional, default `72`)
|
||||
- `options.raw` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** describes raw pixel input image data. See `raw()` for pixel ordering.
|
||||
- `options.raw.width` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `options.raw.height` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `options.raw.channels` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** 1-4
|
||||
- `options.create` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** describes a new image to be created.
|
||||
- `options.create.width` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `options.create.height` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `options.create.channels` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** 3-4
|
||||
- `options.create.background` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))?** parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
sharp('input.jpg')
|
||||
.resize(300, 200)
|
||||
.toFile('output.jpg', function(err) {
|
||||
// output.jpg is a 300 pixels wide and 200 pixels high image
|
||||
// containing a scaled and cropped version of input.jpg
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
// Read image data from readableStream,
|
||||
// resize to 300 pixels wide,
|
||||
// emit an 'info' event with calculated dimensions
|
||||
// and finally write image data to writableStream
|
||||
var transformer = sharp()
|
||||
.resize(300)
|
||||
.on('info', function(info) {
|
||||
console.log('Image height is ' + info.height);
|
||||
});
|
||||
readableStream.pipe(transformer).pipe(writableStream);
|
||||
```
|
||||
|
||||
```javascript
|
||||
// Create a blank 300x200 PNG image of semi-transluent red pixels
|
||||
sharp({
|
||||
create: {
|
||||
width: 300,
|
||||
height: 200,
|
||||
channels: 4,
|
||||
background: { r: 255, g: 0, b: 0, alpha: 128 }
|
||||
}
|
||||
})
|
||||
.png()
|
||||
.toBuffer()
|
||||
.then( ... );
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **[Sharp](#sharp)**
|
||||
|
||||
### format
|
||||
|
||||
An Object containing nested boolean values representing the available input and output formats/methods.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
console.log(sharp.format);
|
||||
```
|
||||
|
||||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||
|
||||
### versions
|
||||
|
||||
An Object containing the version numbers of libvips and its dependencies.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
console.log(sharp.versions);
|
||||
```
|
||||
|
||||
## queue
|
||||
|
||||
An EventEmitter that emits a `change` event when a task is either:
|
||||
|
||||
- queued, waiting for _libuv_ to provide a worker thread
|
||||
- complete
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
sharp.queue.on('change', function(queueLength) {
|
||||
console.log('Queue contains ' + queueLength + ' task(s)');
|
||||
});
|
||||
```
|
@ -1,94 +0,0 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [clone](#clone)
|
||||
- [metadata](#metadata)
|
||||
- [limitInputPixels](#limitinputpixels)
|
||||
- [sequentialRead](#sequentialread)
|
||||
|
||||
## clone
|
||||
|
||||
Take a "snapshot" of the Sharp instance, returning a new instance.
|
||||
Cloned instances inherit the input of their parent instance.
|
||||
This allows multiple output Streams and therefore multiple processing pipelines to share a single input Stream.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
const pipeline = sharp().rotate();
|
||||
pipeline.clone().resize(800, 600).pipe(firstWritableStream);
|
||||
pipeline.clone().extract({ left: 20, top: 20, width: 100, height: 100 }).pipe(secondWritableStream);
|
||||
readableStream.pipe(pipeline);
|
||||
// firstWritableStream receives auto-rotated, resized readableStream
|
||||
// secondWritableStream receives auto-rotated, extracted region of readableStream
|
||||
```
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## metadata
|
||||
|
||||
Fast access to (uncached) image metadata without decoding any compressed image data.
|
||||
A Promises/A+ promise is returned when `callback` is not provided.
|
||||
|
||||
- `format`: Name of decoder used to decompress image data e.g. `jpeg`, `png`, `webp`, `gif`, `svg`
|
||||
- `width`: Number of pixels wide
|
||||
- `height`: Number of pixels high
|
||||
- `space`: Name of colour space interpretation e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://github.com/jcupitt/libvips/blob/master/libvips/iofuncs/enumtypes.c#L636)
|
||||
- `channels`: Number of bands e.g. `3` for sRGB, `4` for CMYK
|
||||
- `depth`: Name of pixel depth format e.g. `uchar`, `char`, `ushort`, `float` [...](https://github.com/jcupitt/libvips/blob/master/libvips/iofuncs/enumtypes.c#L672)
|
||||
- `density`: Number of pixels per inch (DPI), if present
|
||||
- `hasProfile`: Boolean indicating the presence of an embedded ICC profile
|
||||
- `hasAlpha`: Boolean indicating the presence of an alpha transparency channel
|
||||
- `orientation`: Number value of the EXIF Orientation header, if present
|
||||
- `exif`: Buffer containing raw EXIF data, if present
|
||||
- `icc`: Buffer containing raw [ICC](https://www.npmjs.com/package/icc) profile data, if present
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)?** called with the arguments `(err, metadata)`
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
const image = sharp(inputJpg);
|
||||
image
|
||||
.metadata()
|
||||
.then(function(metadata) {
|
||||
return image
|
||||
.resize(Math.round(metadata.width / 2))
|
||||
.webp()
|
||||
.toBuffer();
|
||||
})
|
||||
.then(function(data) {
|
||||
// data contains a WebP image half the width and height of the original JPEG
|
||||
});
|
||||
```
|
||||
|
||||
Returns **([Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)> | Sharp)**
|
||||
|
||||
## limitInputPixels
|
||||
|
||||
Do not process input images where the number of pixels (width _ height) exceeds this limit.
|
||||
Assumes image dimensions contained in the input metadata can be trusted.
|
||||
The default limit is 268402689 (0x3FFF _ 0x3FFF) pixels.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `limit` **([Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** an integral Number of pixels, zero or false to remove limit, true to use default limit.
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid limit
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## sequentialRead
|
||||
|
||||
An advanced setting that switches the libvips access method to `VIPS_ACCESS_SEQUENTIAL`.
|
||||
This will reduce memory usage and can improve performance on some systems.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `sequentialRead` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
@ -1,323 +0,0 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [rotate](#rotate)
|
||||
- [extract](#extract)
|
||||
- [flip](#flip)
|
||||
- [flop](#flop)
|
||||
- [sharpen](#sharpen)
|
||||
- [blur](#blur)
|
||||
- [extend](#extend)
|
||||
- [flatten](#flatten)
|
||||
- [trim](#trim)
|
||||
- [gamma](#gamma)
|
||||
- [negate](#negate)
|
||||
- [normalise](#normalise)
|
||||
- [normalize](#normalize)
|
||||
- [convolve](#convolve)
|
||||
- [threshold](#threshold)
|
||||
- [boolean](#boolean)
|
||||
|
||||
## rotate
|
||||
|
||||
Rotate the output image by either an explicit angle
|
||||
or auto-orient based on the EXIF `Orientation` tag.
|
||||
|
||||
If an angle is provided, it is converted to a valid 90/180/270deg rotation.
|
||||
For example, `-450` will produce a 270deg rotation.
|
||||
|
||||
If no angle is provided, it is determined from the EXIF data.
|
||||
Mirroring is supported and may infer the use of a flip operation.
|
||||
|
||||
The use of `rotate` implies the removal of the EXIF `Orientation` tag, if any.
|
||||
|
||||
Method order is important when both rotating and extracting regions,
|
||||
for example `rotate(x).extract(y)` will produce a different result to `extract(y).rotate(x)`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `angle` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle of rotation, must be a multiple of 90. (optional, default `auto`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
const pipeline = sharp()
|
||||
.rotate()
|
||||
.resize(null, 200)
|
||||
.toBuffer(function (err, outputBuffer, info) {
|
||||
// outputBuffer contains 200px high JPEG image data,
|
||||
// auto-rotated using EXIF Orientation tag
|
||||
// info.width and info.height contain the dimensions of the resized image
|
||||
});
|
||||
readableStream.pipe(pipeline);
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## extract
|
||||
|
||||
Extract a region of the image.
|
||||
|
||||
- Use `extract` before `resize` for pre-resize extraction.
|
||||
- Use `extract` after `resize` for post-resize extraction.
|
||||
- Use `extract` before and after for both.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||
- `options.left` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** zero-indexed offset from left edge
|
||||
- `options.top` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** zero-indexed offset from top edge
|
||||
- `options.width` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** dimension of extracted image
|
||||
- `options.height` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** dimension of extracted image
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.extract({ left: left, top: top, width: width, height: height })
|
||||
.toFile(output, function(err) {
|
||||
// Extract a region of the input image, saving in the same format.
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.extract({ left: leftOffsetPre, top: topOffsetPre, width: widthPre, height: heightPre })
|
||||
.resize(width, height)
|
||||
.extract({ left: leftOffsetPost, top: topOffsetPost, width: widthPost, height: heightPost })
|
||||
.toFile(output, function(err) {
|
||||
// Extract a region, resize, then extract from the resized image
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## flip
|
||||
|
||||
Flip the image about the vertical Y axis. This always occurs after rotation, if any.
|
||||
The use of `flip` implies the removal of the EXIF `Orientation` tag, if any.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `flip` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## flop
|
||||
|
||||
Flop the image about the horizontal X axis. This always occurs after rotation, if any.
|
||||
The use of `flop` implies the removal of the EXIF `Orientation` tag, if any.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `flop` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## sharpen
|
||||
|
||||
Sharpen the image.
|
||||
When used without parameters, performs a fast, mild sharpen of the output image.
|
||||
When a `sigma` is provided, performs a slower, more accurate sharpen of the L channel in the LAB colour space.
|
||||
Separate control over the level of sharpening in "flat" and "jagged" areas is available.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `sigma` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
||||
- `flat` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the level of sharpening to apply to "flat" areas. (optional, default `1.0`)
|
||||
- `jagged` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the level of sharpening to apply to "jagged" areas. (optional, default `2.0`)
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## blur
|
||||
|
||||
Blur the image.
|
||||
When used without parameters, performs a fast, mild blur of the output image.
|
||||
When a `sigma` is provided, performs a slower, more accurate Gaussian blur.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `sigma` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## extend
|
||||
|
||||
Extends/pads the edges of the image with the colour provided to the `background` method.
|
||||
This operation will always occur after resizing and extraction, if any.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `extend` **([Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** single pixel count to add to all edges or an Object with per-edge counts
|
||||
- `extend.top` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `extend.left` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `extend.bottom` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `extend.right` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
// Resize to 140 pixels wide, then add 10 transparent pixels
|
||||
// to the top, left and right edges and 20 to the bottom edge
|
||||
sharp(input)
|
||||
.resize(140)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.extend({top: 10, bottom: 20, left: 10, right: 10})
|
||||
...
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## flatten
|
||||
|
||||
Merge alpha transparency channel, if any, with `background`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `flatten` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## trim
|
||||
|
||||
Trim "boring" pixels from all edges that contain values within a percentage similarity of the top-left pixel.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `tolerance` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** value between 1 and 99 representing the percentage similarity. (optional, default `10`)
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## gamma
|
||||
|
||||
Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of `1/gamma`
|
||||
then increasing the encoding (brighten) post-resize at a factor of `gamma`.
|
||||
This can improve the perceived brightness of a resized image in non-linear colour spaces.
|
||||
JPEG and WebP input images will not take advantage of the shrink-on-load performance optimisation
|
||||
when applying a gamma correction.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `gamma` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** value between 1.0 and 3.0. (optional, default `2.2`)
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## negate
|
||||
|
||||
Produce the "negative" of the image.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `negate` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## normalise
|
||||
|
||||
Enhance output image contrast by stretching its luminance to cover the full dynamic range.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `normalise` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## normalize
|
||||
|
||||
Alternative spelling of normalise.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `normalize` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## convolve
|
||||
|
||||
Convolve the image with the specified kernel.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `kernel` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||
- `kernel.width` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** width of the kernel in pixels.
|
||||
- `kernel.height` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** width of the kernel in pixels.
|
||||
- `kernel.kernel` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** Array of length `width*height` containing the kernel values.
|
||||
- `kernel.scale` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the scale of the kernel in pixels. (optional, default `sum`)
|
||||
- `kernel.offset` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the offset of the kernel in pixels. (optional, default `0`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.convolve({
|
||||
width: 3,
|
||||
height: 3,
|
||||
kernel: [-1, 0, 1, -2, 0, 2, -1, 0, 1]
|
||||
})
|
||||
.raw()
|
||||
.toBuffer(function(err, data, info) {
|
||||
// data contains the raw pixel data representing the convolution
|
||||
// of the input image with the horizontal Sobel operator
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## threshold
|
||||
|
||||
Any pixel value greather than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `threshold` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** a value in the range 0-255 representing the level at which the threshold will be applied. (optional, default `128`)
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?**
|
||||
- `options.greyscale` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** convert to single channel greyscale. (optional, default `true`)
|
||||
- `options.grayscale` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** alternative spelling for greyscale. (optional, default `true`)
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## boolean
|
||||
|
||||
Perform a bitwise boolean operation with operand image.
|
||||
|
||||
This operation creates an output image where each pixel is the result of
|
||||
the selected bitwise boolean `operation` between the corresponding pixels of the input images.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `operand` **([Buffer](https://nodejs.org/api/buffer.html) \| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))** Buffer containing image data or String containing the path to an image file.
|
||||
- `operator` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?**
|
||||
- `options.raw` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** describes operand when using raw pixel data.
|
||||
- `options.raw.width` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `options.raw.height` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
- `options.raw.channels` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
@ -1,200 +0,0 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [toFile](#tofile)
|
||||
- [toBuffer](#tobuffer)
|
||||
- [withMetadata](#withmetadata)
|
||||
- [jpeg](#jpeg)
|
||||
- [png](#png)
|
||||
- [webp](#webp)
|
||||
- [tiff](#tiff)
|
||||
- [raw](#raw)
|
||||
- [toFormat](#toformat)
|
||||
- [tile](#tile)
|
||||
|
||||
## toFile
|
||||
|
||||
Write output image data to a file.
|
||||
|
||||
If an explicit output format is not selected, it will be inferred from the extension,
|
||||
with JPEG, PNG, WebP, TIFF, DZI, and libvips' V format supported.
|
||||
Note that raw pixel data is only supported for buffer output.
|
||||
|
||||
A Promises/A+ promise is returned when `callback` is not provided.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `fileOut` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the path to write the image data to.
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)?** called on completion with two arguments `(err, info)`.
|
||||
`info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
||||
`channels` and `premultiplied` (indicating if premultiplication was used).
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** when no callback is provided
|
||||
|
||||
## toBuffer
|
||||
|
||||
Write output to a Buffer.
|
||||
JPEG, PNG, WebP, TIFF and RAW output are supported.
|
||||
By default, the format will match the input image, except GIF and SVG input which become PNG output.
|
||||
|
||||
`callback`, if present, gets three arguments `(err, data, info)` where:
|
||||
|
||||
- `err` is an error, if any.
|
||||
- `data` is the output image data.
|
||||
- `info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
||||
`channels` and `premultiplied` (indicating if premultiplication was used).
|
||||
A Promise is returned when `callback` is not provided.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?**
|
||||
- `options.resolveWithObject` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`.
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)?**
|
||||
|
||||
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Buffer](https://nodejs.org/api/buffer.html)>** when no callback is provided
|
||||
|
||||
## withMetadata
|
||||
|
||||
Include all metadata (EXIF, XMP, IPTC) from the input image in the output image.
|
||||
The default behaviour, when `withMetadata` is not used, is to strip all metadata and convert to the device-independent sRGB colour space.
|
||||
This will also convert to and add a web-friendly sRGB ICC profile.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `withMetadata` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?**
|
||||
- `withMetadata.orientation` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** value between 1 and 8, used to update the EXIF `Orientation` tag.
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## jpeg
|
||||
|
||||
Use these JPEG options for output image.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** output options
|
||||
- `options.quality` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** quality, integer 1-100 (optional, default `80`)
|
||||
- `options.progressive` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** use progressive (interlace) scan (optional, default `false`)
|
||||
- `options.chromaSubsampling` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** set to '4:4:4' to prevent chroma subsampling when quality <= 90 (optional, default `'4:2:0'`)
|
||||
- `options.trellisQuantisation` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** apply trellis quantisation, requires mozjpeg (optional, default `false`)
|
||||
- `options.overshootDeringing` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** apply overshoot deringing, requires mozjpeg (optional, default `false`)
|
||||
- `options.optimiseScans` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** optimise progressive scans, forces progressive, requires mozjpeg (optional, default `false`)
|
||||
- `options.optimizeScans` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** alternative spelling of optimiseScans (optional, default `false`)
|
||||
- `options.force` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** force JPEG output, otherwise attempt to use input format (optional, default `true`)
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid options
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## png
|
||||
|
||||
Use these PNG options for output image.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?**
|
||||
- `options.progressive` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** use progressive (interlace) scan (optional, default `false`)
|
||||
- `options.compressionLevel` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** zlib compression level (optional, default `6`)
|
||||
- `options.adaptiveFiltering` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** use adaptive row filtering (optional, default `true`)
|
||||
- `options.force` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** force PNG output, otherwise attempt to use input format (optional, default `true`)
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid options
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## webp
|
||||
|
||||
Use these WebP options for output image.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** output options
|
||||
- `options.quality` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** quality, integer 1-100 (optional, default `80`)
|
||||
- `options.alphaQuality` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** quality of alpha layer, integer 0-100 (optional, default `100`)
|
||||
- `options.lossless` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** use lossless compression mode (optional, default `false`)
|
||||
- `options.nearLossless` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** use near_lossless compression mode (optional, default `false`)
|
||||
- `options.force` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** force WebP output, otherwise attempt to use input format (optional, default `true`)
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid options
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## tiff
|
||||
|
||||
Use these TIFF options for output image.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** output options
|
||||
- `options.quality` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** quality, integer 1-100 (optional, default `80`)
|
||||
- `options.force` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** force TIFF output, otherwise attempt to use input format (optional, default `true`)
|
||||
- `options.compression` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** compression options: lzw, deflate, jpeg (optional, default `'jpeg'`)
|
||||
- `options.predictor` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** compression predictor options: none, horizontal, float (optional, default `'none'`)
|
||||
- `options.squash` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** squash 8-bit images down to 1 bit (optional, default `false`)
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid options
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## raw
|
||||
|
||||
Force output to be raw, uncompressed uint8 pixel data.
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## toFormat
|
||||
|
||||
Force output to a given format.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `format` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** as a String or an Object with an 'id' attribute
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** output options
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** unsupported format or options
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## tile
|
||||
|
||||
Use tile-based deep zoom (image pyramid) output.
|
||||
Set the format and options for tile images via the `toFormat`, `jpeg`, `png` or `webp` functions.
|
||||
Use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `tile` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?**
|
||||
- `tile.size` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** tile size in pixels, a value between 1 and 8192. (optional, default `256`)
|
||||
- `tile.overlap` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** tile overlap in pixels, a value between 0 and 8192. (optional, default `0`)
|
||||
- `tile.container` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** tile container, with value `fs` (filesystem) or `zip` (compressed file). (optional, default `'fs'`)
|
||||
- `tile.layout` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** filesystem layout, possible values are `dz`, `zoomify` or `google`. (optional, default `'dz'`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
sharp('input.tiff')
|
||||
.png()
|
||||
.tile({
|
||||
size: 512
|
||||
})
|
||||
.toFile('output.dz', function(err, info) {
|
||||
// output.dzi is the Deep Zoom XML definition
|
||||
// output_files contains 512x512 tiles grouped by zoom level
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
@ -1,177 +0,0 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [resize](#resize)
|
||||
- [crop](#crop)
|
||||
- [embed](#embed)
|
||||
- [max](#max)
|
||||
- [min](#min)
|
||||
- [ignoreAspectRatio](#ignoreaspectratio)
|
||||
- [withoutEnlargement](#withoutenlargement)
|
||||
|
||||
## resize
|
||||
|
||||
Resize image to `width` x `height`.
|
||||
By default, the resized image is centre cropped to the exact size specified.
|
||||
|
||||
Possible reduction kernels are:
|
||||
|
||||
- `nearest`: Use [nearest neighbour interpolation](http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation).
|
||||
- `cubic`: Use a [Catmull-Rom spline](https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline).
|
||||
- `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).
|
||||
|
||||
Possible enlargement interpolators are:
|
||||
|
||||
- `nearest`: Use [nearest neighbour interpolation](http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation).
|
||||
- `bilinear`: Use [bilinear interpolation](http://en.wikipedia.org/wiki/Bilinear_interpolation), faster than bicubic but with less smooth results.
|
||||
- `vertexSplitQuadraticBasisSpline`: Use the smoother [VSQBS interpolation](https://github.com/jcupitt/libvips/blob/master/libvips/resample/vsqbs.cpp#L48) to prevent "staircasing" when enlarging.
|
||||
- `bicubic`: Use [bicubic interpolation](http://en.wikipedia.org/wiki/Bicubic_interpolation) (the default).
|
||||
- `locallyBoundedBicubic`: Use [LBB interpolation](https://github.com/jcupitt/libvips/blob/master/libvips/resample/lbb.cpp#L100), which prevents some "[acutance](http://en.wikipedia.org/wiki/Acutance)" but typically reduces performance by a factor of 2.
|
||||
- `nohalo`: Use [Nohalo interpolation](http://eprints.soton.ac.uk/268086/), which prevents acutance but typically reduces performance by a factor of 3.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `width` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** pixels wide the resultant image should be. Use `null` or `undefined` to auto-scale the width to match the height.
|
||||
- `height` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** pixels high the resultant image should be. Use `null` or `undefined` to auto-scale the height to match the width.
|
||||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?**
|
||||
- `options.kernel` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the kernel to use for image reduction. (optional, default `'lanczos3'`)
|
||||
- `options.interpolator` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the interpolator to use for image enlargement. (optional, default `'bicubic'`)
|
||||
- `options.centreSampling` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** use \*magick centre sampling convention instead of corner sampling. (optional, default `false`)
|
||||
- `options.centerSampling` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** alternative spelling of centreSampling. (optional, default `false`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
sharp(inputBuffer)
|
||||
.resize(200, 300, {
|
||||
kernel: sharp.kernel.lanczos2,
|
||||
interpolator: sharp.interpolator.nohalo
|
||||
})
|
||||
.background('white')
|
||||
.embed()
|
||||
.toFile('output.tiff')
|
||||
.then(function() {
|
||||
// output.tiff is a 200 pixels wide and 300 pixels high image
|
||||
// containing a lanczos2/nohalo scaled version, embedded on a white canvas,
|
||||
// of the image data in inputBuffer
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## crop
|
||||
|
||||
Crop the resized image to the exact size specified, the default behaviour.
|
||||
|
||||
Possible attributes of the optional `sharp.gravity` are `north`, `northeast`, `east`, `southeast`, `south`,
|
||||
`southwest`, `west`, `northwest`, `center` and `centre`.
|
||||
|
||||
The experimental strategy-based approach resizes so one dimension is at its target length
|
||||
then repeatedly ranks edge regions, discarding the edge with the lowest score based on the selected strategy.
|
||||
|
||||
- `entropy`: focus on the region with the highest [Shannon entropy](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.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `crop` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** A member of `sharp.gravity` to crop to an edge/corner or `sharp.strategy` to crop dynamically. (optional, default `'centre'`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
const transformer = sharp()
|
||||
.resize(200, 200)
|
||||
.crop(sharp.strategy.entropy)
|
||||
.on('error', function(err) {
|
||||
console.log(err);
|
||||
});
|
||||
// Read image data from readableStream
|
||||
// Write 200px square auto-cropped image data to writableStream
|
||||
readableStream.pipe(transformer).pipe(writableStream);
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## embed
|
||||
|
||||
Preserving aspect ratio, resize the image to the maximum `width` or `height` specified
|
||||
then embed on a background of the exact `width` and `height` specified.
|
||||
|
||||
If the background contains an alpha value then WebP and PNG format output images will
|
||||
contain an alpha channel, even when the input image does not.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
sharp('input.gif')
|
||||
.resize(200, 300)
|
||||
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||
.embed()
|
||||
.toFormat(sharp.format.webp)
|
||||
.toBuffer(function(err, outputBuffer) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
// outputBuffer contains WebP image data of a 200 pixels wide and 300 pixels high
|
||||
// containing a scaled version, embedded on a transparent canvas, of input.gif
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## max
|
||||
|
||||
Preserving aspect ratio, resize the image to be as large as possible
|
||||
while ensuring its dimensions are less than or equal to the `width` and `height` specified.
|
||||
|
||||
Both `width` and `height` must be provided via `resize` otherwise the behaviour will default to `crop`.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
sharp(inputBuffer)
|
||||
.resize(200, 200)
|
||||
.max()
|
||||
.toFormat('jpeg')
|
||||
.toBuffer()
|
||||
.then(function(outputBuffer) {
|
||||
// outputBuffer contains JPEG image data no wider than 200 pixels and no higher
|
||||
// than 200 pixels regardless of the inputBuffer image dimensions
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## min
|
||||
|
||||
Preserving aspect ratio, resize the image to be as small as possible
|
||||
while ensuring its dimensions are greater than or equal to the `width` and `height` specified.
|
||||
|
||||
Both `width` and `height` must be provided via `resize` otherwise the behaviour will default to `crop`.
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## ignoreAspectRatio
|
||||
|
||||
Ignoring the aspect ratio of the input, stretch the image to
|
||||
the exact `width` and/or `height` provided via `resize`.
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## withoutEnlargement
|
||||
|
||||
Do not enlarge the output image if the input image width _or_ height are already less than the required dimensions.
|
||||
This is equivalent to GraphicsMagick's `>` geometry option:
|
||||
"_change the dimensions of the image only if its width or height exceeds the geometry specification_".
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `withoutEnlargement` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
@ -1,106 +0,0 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [cache](#cache)
|
||||
- [concurrency](#concurrency)
|
||||
- [counters](#counters)
|
||||
- [simd](#simd)
|
||||
|
||||
## cache
|
||||
|
||||
Gets, or when options are provided sets, the limits of _libvips'_ operation cache.
|
||||
Existing entries in the cache will be trimmed after any change in limits.
|
||||
This method always returns cache statistics,
|
||||
useful for determining how much working memory is required for a particular task.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `options` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** Object with the following attributes, or Boolean where true uses default cache settings and false removes all caching.
|
||||
- `options.memory` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** is the maximum memory in MB to use for this cache (optional, default `50`)
|
||||
- `options.files` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** is the maximum number of files to hold open (optional, default `20`)
|
||||
- `options.items` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** is the maximum number of operations to cache (optional, default `100`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
const stats = sharp.cache();
|
||||
```
|
||||
|
||||
```javascript
|
||||
sharp.cache( { items: 200 } );
|
||||
sharp.cache( { files: 0 } );
|
||||
sharp.cache(false);
|
||||
```
|
||||
|
||||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||
|
||||
## concurrency
|
||||
|
||||
Gets, or when a concurrency is provided sets,
|
||||
the number of threads _libvips'_ should create to process each image.
|
||||
The default value is the number of CPU cores.
|
||||
A value of `0` will reset to this default.
|
||||
|
||||
The maximum number of images that can be processed in parallel
|
||||
is limited by libuv's `UV_THREADPOOL_SIZE` environment variable.
|
||||
|
||||
This method always returns the current concurrency.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `concurrency` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?**
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
const threads = sharp.concurrency(); // 4
|
||||
sharp.concurrency(2); // 2
|
||||
sharp.concurrency(0); // 4
|
||||
```
|
||||
|
||||
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** concurrency
|
||||
|
||||
## counters
|
||||
|
||||
Provides access to internal task counters.
|
||||
|
||||
- queue is the number of tasks this module has queued waiting for _libuv_ to provide a worker thread from its pool.
|
||||
- process is the number of resize tasks currently being processed.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
const counters = sharp.counters(); // { queue: 2, process: 4 }
|
||||
```
|
||||
|
||||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||
|
||||
## simd
|
||||
|
||||
Get and set use of SIMD vector unit instructions.
|
||||
Requires libvips to have been compiled with liborc support.
|
||||
|
||||
Improves the performance of `resize`, `blur` and `sharpen` operations
|
||||
by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
|
||||
|
||||
This feature is currently off by default but future versions may reverse this.
|
||||
Versions of liborc prior to 0.4.25 are known to segfault under heavy load.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `simd` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `false`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
const simd = sharp.simd();
|
||||
// simd is `true` if SIMD is currently enabled
|
||||
```
|
||||
|
||||
```javascript
|
||||
const simd = sharp.simd(true);
|
||||
// attempts to enable the use of SIMD, returning true if available
|
||||
```
|
||||
|
||||
Returns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
|
90
docs/astro.config.mjs
Normal file
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}`
|
||||
}
|
||||
});
|
42
docs/build.mjs
Normal file
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);
|
||||
});
|
@ -1,593 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
### v0.18 - "*ridge*"
|
||||
|
||||
Requires libvips v8.5.5.
|
||||
|
||||
#### v0.18.0 - 30<sup>th</sup> May 2017
|
||||
|
||||
* Remove the previously-deprecated output format "option" functions:
|
||||
quality, progressive, compressionLevel, withoutAdaptiveFiltering,
|
||||
withoutChromaSubsampling, trellisQuantisation, trellisQuantization,
|
||||
overshootDeringing, optimiseScans and optimizeScans.
|
||||
|
||||
* Ensure maximum output dimensions are based on the format to be used.
|
||||
[#176](https://github.com/lovell/sharp/issues/176)
|
||||
[@stephanebachelier](https://github.com/stephanebachelier)
|
||||
|
||||
* Avoid costly (un)premultiply when using overlayWith without alpha channel.
|
||||
[#573](https://github.com/lovell/sharp/issues/573)
|
||||
[@strarsis](https://github.com/strarsis)
|
||||
|
||||
* Include pixel depth (e.g. "uchar") when reading metadata.
|
||||
[#577](https://github.com/lovell/sharp/issues/577)
|
||||
[@moedusa](https://github.com/moedusa)
|
||||
|
||||
* Add support for Buffer and Stream-based TIFF output.
|
||||
[#587](https://github.com/lovell/sharp/issues/587)
|
||||
[@strarsis](https://github.com/strarsis)
|
||||
|
||||
* Expose warnings from libvips via NODE_DEBUG=sharp environment variable.
|
||||
[#607](https://github.com/lovell/sharp/issues/607)
|
||||
[@puzrin](https://github.com/puzrin)
|
||||
|
||||
* Switch to the libvips implementation of "attention" and "entropy" crop strategies.
|
||||
[#727](https://github.com/lovell/sharp/issues/727)
|
||||
|
||||
* Improve performance and accuracy of nearest neighbour integral upsampling.
|
||||
[#752](https://github.com/lovell/sharp/issues/752)
|
||||
[@MrIbby](https://github.com/MrIbby)
|
||||
|
||||
* Constructor single argument API: allow plain object, reject null/undefined.
|
||||
[#768](https://github.com/lovell/sharp/issues/768)
|
||||
[@kub1x](https://github.com/kub1x)
|
||||
|
||||
* Ensure ARM64 pre-built binaries use correct C++11 ABI version.
|
||||
[#772](https://github.com/lovell/sharp/issues/772)
|
||||
[@ajiratech2](https://github.com/ajiratech2)
|
||||
|
||||
* Prevent aliasing by using dynamic values for shrink(-on-load).
|
||||
[#781](https://github.com/lovell/sharp/issues/781)
|
||||
[@kleisauke](https://github.com/kleisauke)
|
||||
|
||||
* Expose libvips' "squash" parameter to enable 1-bit TIFF output.
|
||||
[#783](https://github.com/lovell/sharp/pull/783)
|
||||
[@YvesBos](https://github.com/YvesBos)
|
||||
|
||||
* Add support for rotation using any multiple of +/-90 degrees.
|
||||
[#791](https://github.com/lovell/sharp/pull/791)
|
||||
[@ncoden](https://github.com/ncoden)
|
||||
|
||||
* Add "jpg" alias to toFormat as shortened form of "jpeg".
|
||||
[#814](https://github.com/lovell/sharp/pull/814)
|
||||
[@jingsam](https://github.com/jingsam)
|
||||
|
||||
### v0.17 - "*quill*"
|
||||
|
||||
Requires libvips v8.4.2.
|
||||
|
||||
#### v0.17.3 - 1<sup>st</sup> April 2017
|
||||
|
||||
* Allow toBuffer to optionally resolve a Promise with both info and data.
|
||||
[#143](https://github.com/lovell/sharp/issues/143)
|
||||
[@salzhrani](https://github.com/salzhrani)
|
||||
|
||||
* Create blank image of given width, height, channels and background.
|
||||
[#470](https://github.com/lovell/sharp/issues/470)
|
||||
[@pjarts](https://github.com/pjarts)
|
||||
|
||||
* Add support for the "nearest" kernel for image reductions.
|
||||
[#732](https://github.com/lovell/sharp/pull/732)
|
||||
[@alice0meta](https://github.com/alice0meta)
|
||||
|
||||
* Add support for TIFF compression and predictor options.
|
||||
[#738](https://github.com/lovell/sharp/pull/738)
|
||||
[@kristojorg](https://github.com/kristojorg)
|
||||
|
||||
#### v0.17.2 - 11<sup>th</sup> February 2017
|
||||
|
||||
* Ensure Readable side of Stream can start flowing after Writable side has finished.
|
||||
[#671](https://github.com/lovell/sharp/issues/671)
|
||||
[@danhaller](https://github.com/danhaller)
|
||||
|
||||
* Expose WebP alpha quality, lossless and near-lossless output options.
|
||||
[#685](https://github.com/lovell/sharp/pull/685)
|
||||
[@rnanwani](https://github.com/rnanwani)
|
||||
|
||||
#### v0.17.1 - 15<sup>th</sup> January 2017
|
||||
|
||||
* Improve error messages for invalid parameters.
|
||||
[@spikeon](https://github.com/spikeon)
|
||||
[#644](https://github.com/lovell/sharp/pull/644)
|
||||
|
||||
* Simplify expression for finding vips-cpp libdir.
|
||||
[#656](https://github.com/lovell/sharp/pull/656)
|
||||
|
||||
* Allow HTTPS-over-HTTP proxy when downloading pre-compiled dependencies.
|
||||
[@wangzhiwei1888](https://github.com/wangzhiwei1888)
|
||||
[#679](https://github.com/lovell/sharp/issues/679)
|
||||
|
||||
#### v0.17.0 - 11<sup>th</sup> December 2016
|
||||
|
||||
* Drop support for versions of Node prior to v4.
|
||||
|
||||
* Deprecate the following output format "option" functions:
|
||||
quality, progressive, compressionLevel, withoutAdaptiveFiltering,
|
||||
withoutChromaSubsampling, trellisQuantisation, trellisQuantization,
|
||||
overshootDeringing, optimiseScans and optimizeScans.
|
||||
Access to these is now via output format functions, for example `quality(n)`
|
||||
is now `jpeg({quality: n})` and/or `webp({quality: n})`.
|
||||
|
||||
* Autoconvert GIF and SVG input to PNG output if no other format is specified.
|
||||
|
||||
* Expose libvips' "centre" resize option to mimic \*magick's +0.5px convention.
|
||||
[#568](https://github.com/lovell/sharp/issues/568)
|
||||
|
||||
* Ensure support for embedded base64 PNG and JPEG images within an SVG.
|
||||
[#601](https://github.com/lovell/sharp/issues/601)
|
||||
[@dynamite-ready](https://github.com/dynamite-ready)
|
||||
|
||||
* Ensure premultiply operation occurs before box filter shrink.
|
||||
[#605](https://github.com/lovell/sharp/issues/605)
|
||||
[@CmdrShepardsPie](https://github.com/CmdrShepardsPie)
|
||||
[@teroparvinen](https://github.com/teroparvinen)
|
||||
|
||||
* Add support for PNG and WebP tile-based output formats (in addition to JPEG).
|
||||
[#622](https://github.com/lovell/sharp/pull/622)
|
||||
[@ppaskaris](https://github.com/ppaskaris)
|
||||
|
||||
* Allow use of extend with greyscale input.
|
||||
[#623](https://github.com/lovell/sharp/pull/623)
|
||||
[@ppaskaris](https://github.com/ppaskaris)
|
||||
|
||||
* Allow non-RGB input to embed/extend onto background with an alpha channel.
|
||||
[#646](https://github.com/lovell/sharp/issues/646)
|
||||
[@DaGaMs](https://github.com/DaGaMs)
|
||||
|
||||
### v0.16 - "*pencil*"
|
||||
|
||||
Requires libvips v8.3.3
|
||||
|
||||
#### v0.16.2 - 22<sup>nd</sup> October 2016
|
||||
|
||||
* Restrict readelf usage to Linux only when detecting global libvips version.
|
||||
[#602](https://github.com/lovell/sharp/issues/602)
|
||||
[@caoko](https://github.com/caoko)
|
||||
|
||||
#### v0.16.1 - 13<sup>th</sup> October 2016
|
||||
|
||||
* C++11 ABI version is now auto-detected, remove sharp-cxx11 installation flag.
|
||||
|
||||
* Add experimental 'attention' crop strategy.
|
||||
[#295](https://github.com/lovell/sharp/issues/295)
|
||||
|
||||
* Include .node extension for Meteor's require() implementation.
|
||||
[#537](https://github.com/lovell/sharp/issues/537)
|
||||
[@isjackwild](https://github.com/isjackwild)
|
||||
|
||||
* Ensure convolution kernel scale is clamped to a minimum value of 1.
|
||||
[#561](https://github.com/lovell/sharp/issues/561)
|
||||
[@abagshaw](https://github.com/abagshaw)
|
||||
|
||||
* Correct calculation of y-axis placement when overlaying image at a fixed point.
|
||||
[#566](https://github.com/lovell/sharp/issues/566)
|
||||
[@Nateowami](https://github.com/Nateowami)
|
||||
|
||||
#### v0.16.0 - 18<sup>th</sup> August 2016
|
||||
|
||||
* Add pre-compiled libvips for OS X, ARMv7 and ARMv8.
|
||||
[#312](https://github.com/lovell/sharp/issues/312)
|
||||
|
||||
* Ensure boolean, bandbool, extractChannel ops occur before sRGB conversion.
|
||||
[#504](https://github.com/lovell/sharp/pull/504)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Recalculate factors after WebP shrink-on-load to avoid round-to-zero errors.
|
||||
[#508](https://github.com/lovell/sharp/issues/508)
|
||||
[@asilvas](https://github.com/asilvas)
|
||||
|
||||
* Prevent boolean errors during extract operation.
|
||||
[#511](https://github.com/lovell/sharp/pull/511)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add joinChannel and toColourspace/toColorspace operations.
|
||||
[#513](https://github.com/lovell/sharp/pull/513)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add support for raw pixel data with boolean and withOverlay operations.
|
||||
[#516](https://github.com/lovell/sharp/pull/516)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Prevent bandbool creating a single channel sRGB image.
|
||||
[#519](https://github.com/lovell/sharp/pull/519)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Ensure ICC profiles are removed from PNG output unless withMetadata used.
|
||||
[#521](https://github.com/lovell/sharp/issues/521)
|
||||
[@ChrisPinewood](https://github.com/ChrisPinewood)
|
||||
|
||||
* Add alpha channels, if missing, to overlayWith images.
|
||||
[#540](https://github.com/lovell/sharp/pull/540)
|
||||
[@cmtt](https://github.com/cmtt)
|
||||
|
||||
* Remove deprecated interpolateWith method - use resize(w, h, { interpolator: ... })
|
||||
[#310](https://github.com/lovell/sharp/issues/310)
|
||||
|
||||
### v0.15 - "*outfit*"
|
||||
|
||||
Requires libvips v8.3.1
|
||||
|
||||
#### v0.15.1 - 12<sup>th</sup> July 2016
|
||||
|
||||
* Concat Stream-based input in single operation for ~+3% perf and less GC.
|
||||
[#429](https://github.com/lovell/sharp/issues/429)
|
||||
[@papandreou](https://github.com/papandreou)
|
||||
|
||||
* Add alpha channel, if required, before extend operation.
|
||||
[#439](https://github.com/lovell/sharp/pull/439)
|
||||
[@frulo](https://github.com/frulo)
|
||||
|
||||
* Allow overlay image to be repeated across entire image via tile option.
|
||||
[#443](https://github.com/lovell/sharp/pull/443)
|
||||
[@lemnisk8](https://github.com/lemnisk8)
|
||||
|
||||
* Add cutout option to overlayWith feature, applies only the alpha channel of the overlay image.
|
||||
[#448](https://github.com/lovell/sharp/pull/448)
|
||||
[@kleisauke](https://github.com/kleisauke)
|
||||
|
||||
* Ensure scaling factors are calculated independently to prevent rounding errors.
|
||||
[#452](https://github.com/lovell/sharp/issues/452)
|
||||
[@puzrin](https://github.com/puzrin)
|
||||
|
||||
* Add --sharp-cxx11 flag to compile with gcc's new C++11 ABI.
|
||||
[#456](https://github.com/lovell/sharp/pull/456)
|
||||
[@kapouer](https://github.com/kapouer)
|
||||
|
||||
* Add top/left offset support to overlayWith operation.
|
||||
[#473](https://github.com/lovell/sharp/pull/473)
|
||||
[@rnanwani](https://github.com/rnanwani)
|
||||
|
||||
* Add convolve operation for kernel-based convolution.
|
||||
[#479](https://github.com/lovell/sharp/pull/479)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add greyscale option to threshold operation for colourspace conversion control.
|
||||
[#480](https://github.com/lovell/sharp/pull/480)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Ensure ICC profiles are licenced for distribution.
|
||||
[#486](https://github.com/lovell/sharp/issues/486)
|
||||
[@kapouer](https://github.com/kapouer)
|
||||
|
||||
* Allow images with an alpha channel to work with LAB-colourspace based sharpen.
|
||||
[#490](https://github.com/lovell/sharp/issues/490)
|
||||
[@jwagner](https://github.com/jwagner)
|
||||
|
||||
* Add trim operation to remove "boring" edges.
|
||||
[#492](https://github.com/lovell/sharp/pull/492)
|
||||
[@kleisauke](https://github.com/kleisauke)
|
||||
|
||||
* Add bandbool feature for channel-wise boolean operations.
|
||||
[#496](https://github.com/lovell/sharp/pull/496)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add extractChannel operation to extract a channel from an image.
|
||||
[#497](https://github.com/lovell/sharp/pull/497)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add ability to read and write native libvips .v files.
|
||||
[#500](https://github.com/lovell/sharp/pull/500)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add boolean feature for bitwise image operations.
|
||||
[#501](https://github.com/lovell/sharp/pull/501)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
#### v0.15.0 - 21<sup>st</sup> May 2016
|
||||
|
||||
* Use libvips' new Lanczos 3 kernel as default for image reduction.
|
||||
Deprecate interpolateWith method, now provided as a resize option.
|
||||
[#310](https://github.com/lovell/sharp/issues/310)
|
||||
[@jcupitt](https://github.com/jcupitt)
|
||||
|
||||
* Take advantage of libvips v8.3 features.
|
||||
Add support for libvips' new GIF and SVG loaders.
|
||||
Pre-built binaries now include giflib and librsvg, exclude *magick.
|
||||
Use shrink-on-load for WebP input.
|
||||
Break existing sharpen API to accept sigma and improve precision.
|
||||
[#369](https://github.com/lovell/sharp/issues/369)
|
||||
|
||||
* Remove unnecessary (un)premultiply operations when not resizing/compositing.
|
||||
[#413](https://github.com/lovell/sharp/issues/413)
|
||||
[@jardakotesovec](https://github.com/jardakotesovec)
|
||||
|
||||
### v0.14 - "*needle*"
|
||||
|
||||
Requires libvips v8.2.3
|
||||
|
||||
#### v0.14.1 - 16<sup>th</sup> April 2016
|
||||
|
||||
* Allow removal of limitation on input pixel count via limitInputPixels. Use with care.
|
||||
[#250](https://github.com/lovell/sharp/issues/250)
|
||||
[#316](https://github.com/lovell/sharp/pull/316)
|
||||
[@anandthakker](https://github.com/anandthakker)
|
||||
[@kentongray](https://github.com/kentongray)
|
||||
|
||||
* Use final output image for metadata passed to callback.
|
||||
[#399](https://github.com/lovell/sharp/pull/399)
|
||||
[@salzhrani](https://github.com/salzhrani)
|
||||
|
||||
* Add support for writing tiled images to a zip container.
|
||||
[#402](https://github.com/lovell/sharp/pull/402)
|
||||
[@felixbuenemann](https://github.com/felixbuenemann)
|
||||
|
||||
* Allow use of embed with 1 and 2 channel images.
|
||||
[#411](https://github.com/lovell/sharp/issues/411)
|
||||
[@janaz](https://github.com/janaz)
|
||||
|
||||
* Improve Electron compatibility by allowing node-gyp rebuilds without npm.
|
||||
[#412](https://github.com/lovell/sharp/issues/412)
|
||||
[@nouh](https://github.com/nouh)
|
||||
|
||||
#### v0.14.0 - 2<sup>nd</sup> April 2016
|
||||
|
||||
* Add ability to extend (pad) the edges of an image.
|
||||
[#128](https://github.com/lovell/sharp/issues/128)
|
||||
[@blowsie](https://github.com/blowsie)
|
||||
|
||||
* Add support for Zoomify and Google tile layouts. Breaks existing tile API.
|
||||
[#223](https://github.com/lovell/sharp/issues/223)
|
||||
[@bdunnette](https://github.com/bdunnette)
|
||||
|
||||
* Improvements to overlayWith: differing sizes/formats, gravity, buffer input.
|
||||
[#239](https://github.com/lovell/sharp/issues/239)
|
||||
[@chrisriley](https://github.com/chrisriley)
|
||||
|
||||
* Add entropy-based crop strategy to remove least interesting edges.
|
||||
[#295](https://github.com/lovell/sharp/issues/295)
|
||||
[@rightaway](https://github.com/rightaway)
|
||||
|
||||
* Expose density metadata; set density of images from vector input.
|
||||
[#338](https://github.com/lovell/sharp/issues/338)
|
||||
[@lookfirst](https://github.com/lookfirst)
|
||||
|
||||
* Emit post-processing 'info' event for Stream output.
|
||||
[#367](https://github.com/lovell/sharp/issues/367)
|
||||
[@salzhrani](https://github.com/salzhrani)
|
||||
|
||||
* Ensure output image EXIF Orientation values are within 1-8 range.
|
||||
[#385](https://github.com/lovell/sharp/pull/385)
|
||||
[@jtobinisaniceguy](https://github.com/jtobinisaniceguy)
|
||||
|
||||
* Ensure ratios are not swapped when rotating 90/270 and ignoring aspect.
|
||||
[#387](https://github.com/lovell/sharp/issues/387)
|
||||
[@kleisauke](https://github.com/kleisauke)
|
||||
|
||||
* Remove deprecated style of calling extract API. Breaks calls using positional arguments.
|
||||
[#276](https://github.com/lovell/sharp/issues/276)
|
||||
|
||||
### v0.13 - "*mind*"
|
||||
|
||||
Requires libvips v8.2.2
|
||||
|
||||
#### v0.13.1 - 27<sup>th</sup> February 2016
|
||||
|
||||
* Fix embedding onto transparent backgrounds; regression introduced in v0.13.0.
|
||||
[#366](https://github.com/lovell/sharp/issues/366)
|
||||
[@diegocsandrim](https://github.com/diegocsandrim)
|
||||
|
||||
#### v0.13.0 - 15<sup>th</sup> February 2016
|
||||
|
||||
* Improve vector image support by allowing control of density/DPI.
|
||||
Switch pre-built libs from Imagemagick to Graphicsmagick.
|
||||
[#110](https://github.com/lovell/sharp/issues/110)
|
||||
[@bradisbell](https://github.com/bradisbell)
|
||||
|
||||
* Add support for raw, uncompressed pixel Buffer/Stream input.
|
||||
[#220](https://github.com/lovell/sharp/issues/220)
|
||||
[@mikemorris](https://github.com/mikemorris)
|
||||
|
||||
* Switch from libvips' C to C++ bindings, requires upgrade to v8.2.2.
|
||||
[#299](https://github.com/lovell/sharp/issues/299)
|
||||
|
||||
* Control number of open files in libvips' cache; breaks existing `cache` behaviour.
|
||||
[#315](https://github.com/lovell/sharp/issues/315)
|
||||
[@impomezia](https://github.com/impomezia)
|
||||
|
||||
* Ensure 16-bit input images can be normalised and embedded onto transparent backgrounds.
|
||||
[#339](https://github.com/lovell/sharp/issues/339)
|
||||
[#340](https://github.com/lovell/sharp/issues/340)
|
||||
[@janaz](https://github.com/janaz)
|
||||
|
||||
* Ensure selected format takes precedence over any unknown output filename extension.
|
||||
[#344](https://github.com/lovell/sharp/issues/344)
|
||||
[@ubaltaci](https://github.com/ubaltaci)
|
||||
|
||||
* Add support for libvips' PBM, PGM, PPM and FITS image format loaders.
|
||||
[#347](https://github.com/lovell/sharp/issues/347)
|
||||
[@oaleynik](https://github.com/oaleynik)
|
||||
|
||||
* Ensure default crop gravity is center/centre.
|
||||
[#351](https://github.com/lovell/sharp/pull/351)
|
||||
[@joelmukuthu](https://github.com/joelmukuthu)
|
||||
|
||||
* Improve support for musl libc systems e.g. Alpine Linux.
|
||||
[#354](https://github.com/lovell/sharp/issues/354)
|
||||
[#359](https://github.com/lovell/sharp/pull/359)
|
||||
[@download13](https://github.com/download13)
|
||||
[@wjordan](https://github.com/wjordan)
|
||||
|
||||
* Small optimisation when reducing by an integral factor to favour shrink over affine.
|
||||
|
||||
* Add support for gamma correction of images with an alpha channel.
|
||||
|
||||
### v0.12 - "*look*"
|
||||
|
||||
Requires libvips v8.2.0
|
||||
|
||||
#### v0.12.2 - 16<sup>th</sup> January 2016
|
||||
|
||||
* Upgrade libvips to v8.2.0 for improved vips_shrink.
|
||||
|
||||
* Add pre-compiled libvips for ARMv6+ CPUs.
|
||||
|
||||
* Ensure 16-bit input images work with embed option.
|
||||
[#325](https://github.com/lovell/sharp/issues/325)
|
||||
[@janaz](https://github.com/janaz)
|
||||
|
||||
* Allow compilation with gmake to provide FreeBSD support.
|
||||
[#326](https://github.com/lovell/sharp/issues/326)
|
||||
[@c0decafe](https://github.com/c0decafe)
|
||||
|
||||
* Attempt to remove temporary file after installation.
|
||||
[#331](https://github.com/lovell/sharp/issues/331)
|
||||
[@dtoubelis](https://github.com/dtoubelis)
|
||||
|
||||
#### v0.12.1 - 12<sup>th</sup> December 2015
|
||||
|
||||
* Allow use of SIMD vector instructions (via liborc) to be toggled on/off.
|
||||
[#172](https://github.com/lovell/sharp/issues/172)
|
||||
[@bkw](https://github.com/bkw)
|
||||
[@puzrin](https://github.com/puzrin)
|
||||
|
||||
* Ensure embedded ICC profiles output with perceptual intent.
|
||||
[#321](https://github.com/lovell/sharp/issues/321)
|
||||
[@vlapo](https://github.com/vlapo)
|
||||
|
||||
* Use the NPM-configured HTTPS proxy, if any, for binary downloads.
|
||||
|
||||
#### v0.12.0 - 23<sup>rd</sup> November 2015
|
||||
|
||||
* Bundle pre-compiled libvips and its dependencies for 64-bit Linux and Windows.
|
||||
[#42](https://github.com/lovell/sharp/issues/42)
|
||||
|
||||
* Take advantage of libvips v8.1.0+ features.
|
||||
[#152](https://github.com/lovell/sharp/issues/152)
|
||||
|
||||
* Add support for 64-bit Windows. Drop support for 32-bit Windows.
|
||||
[#224](https://github.com/lovell/sharp/issues/224)
|
||||
[@sabrehagen](https://github.com/sabrehagen)
|
||||
|
||||
* Switch default interpolator to bicubic.
|
||||
[#289](https://github.com/lovell/sharp/issues/289)
|
||||
[@mahnunchik](https://github.com/mahnunchik)
|
||||
|
||||
* Pre-extract rotatation should not swap width/height.
|
||||
[#296](https://github.com/lovell/sharp/issues/296)
|
||||
[@asilvas](https://github.com/asilvas)
|
||||
|
||||
* Ensure 16-bit+alpha input images are (un)premultiplied correctly.
|
||||
[#301](https://github.com/lovell/sharp/issues/301)
|
||||
[@izaakschroeder](https://github.com/izaakschroeder)
|
||||
|
||||
* Add `threshold` operation.
|
||||
[#303](https://github.com/lovell/sharp/pull/303)
|
||||
[@dacarley](https://github.com/dacarley)
|
||||
|
||||
* Add `negate` operation.
|
||||
[#306](https://github.com/lovell/sharp/pull/306)
|
||||
[@dacarley](https://github.com/dacarley)
|
||||
|
||||
* Support `options` Object with existing `extract` operation.
|
||||
[#309](https://github.com/lovell/sharp/pull/309)
|
||||
[@papandreou](https://github.com/papandreou)
|
||||
|
||||
### v0.11 - "*knife*"
|
||||
|
||||
#### v0.11.4 - 5<sup>th</sup> November 2015
|
||||
|
||||
* Add corners, e.g. `northeast`, to existing `gravity` option.
|
||||
[#291](https://github.com/lovell/sharp/pull/291)
|
||||
[@brandonaaron](https://github.com/brandonaaron)
|
||||
|
||||
* Ensure correct auto-rotation for EXIF Orientation values 2 and 4.
|
||||
[#288](https://github.com/lovell/sharp/pull/288)
|
||||
[@brandonaaron](https://github.com/brandonaaron)
|
||||
|
||||
* Make static linking possible via `--runtime_link` install option.
|
||||
[#287](https://github.com/lovell/sharp/pull/287)
|
||||
[@vlapo](https://github.com/vlapo)
|
||||
|
||||
#### v0.11.3 - 8<sup>th</sup> September 2015
|
||||
|
||||
* Intrepret blurSigma, sharpenFlat, and sharpenJagged as double precision.
|
||||
[#263](https://github.com/lovell/sharp/pull/263)
|
||||
[@chrisriley](https://github.com/chrisriley)
|
||||
|
||||
#### v0.11.2 - 28<sup>th</sup> August 2015
|
||||
|
||||
* Allow crop gravity to be provided as a String.
|
||||
[#255](https://github.com/lovell/sharp/pull/255)
|
||||
[@papandreou](https://github.com/papandreou)
|
||||
* Add support for io.js v3 and Node v4.
|
||||
[#246](https://github.com/lovell/sharp/issues/246)
|
||||
|
||||
#### v0.11.1 - 12<sup>th</sup> August 2015
|
||||
|
||||
* Silence MSVC warning: "C4530: C++ exception handler used, but unwind semantics are not enabled".
|
||||
[#244](https://github.com/lovell/sharp/pull/244)
|
||||
[@TheThing](https://github.com/TheThing)
|
||||
|
||||
* Suppress gamma correction for input image with alpha transparency.
|
||||
[#249](https://github.com/lovell/sharp/issues/249)
|
||||
[@compeak](https://github.com/compeak)
|
||||
|
||||
#### v0.11.0 - 15<sup>th</sup> July 2015
|
||||
|
||||
* Allow alpha transparency compositing via new `overlayWith` method.
|
||||
[#97](https://github.com/lovell/sharp/issues/97)
|
||||
[@gasi](https://github.com/gasi)
|
||||
|
||||
* Expose raw ICC profile data as a Buffer when using `metadata`.
|
||||
[#129](https://github.com/lovell/sharp/issues/129)
|
||||
[@homerjam](https://github.com/homerjam)
|
||||
|
||||
* Allow image header updates via a parameter passed to existing `withMetadata` method.
|
||||
Provide initial support for EXIF `Orientation` tag,
|
||||
which if present is now removed when using `rotate`, `flip` or `flop`.
|
||||
[#189](https://github.com/lovell/sharp/issues/189)
|
||||
[@h2non](https://github.com/h2non)
|
||||
|
||||
* Tighten constructor parameter checks.
|
||||
[#221](https://github.com/lovell/sharp/issues/221)
|
||||
[@mikemorris](https://github.com/mikemorris)
|
||||
|
||||
* Allow one input Stream to be shared with two or more output Streams via new `clone` method.
|
||||
[#235](https://github.com/lovell/sharp/issues/235)
|
||||
[@jaubourg](https://github.com/jaubourg)
|
||||
|
||||
* Use `round` instead of `floor` when auto-scaling dimensions to avoid floating-point rounding errors.
|
||||
[#238](https://github.com/lovell/sharp/issues/238)
|
||||
[@richardadjogah](https://github.com/richardadjogah)
|
||||
|
||||
### v0.10 - "*judgment*"
|
||||
|
||||
#### v0.10.1 - 1<sup>st</sup> June 2015
|
||||
|
||||
* Allow embed of image with alpha transparency onto non-transparent background.
|
||||
[#204](https://github.com/lovell/sharp/issues/204)
|
||||
[@mikemliu](https://github.com/mikemliu)
|
||||
|
||||
* Include C standard library for `atoi` as Xcode 6.3 appears to no longer do this.
|
||||
[#228](https://github.com/lovell/sharp/issues/228)
|
||||
[@doggan](https://github.com/doggan)
|
||||
|
||||
#### v0.10.0 - 23<sup>rd</sup> April 2015
|
||||
|
||||
* Add support for Windows (x86).
|
||||
[#19](https://github.com/lovell/sharp/issues/19)
|
||||
[@DullReferenceException](https://github.com/DullReferenceException)
|
||||
[@itsananderson](https://github.com/itsananderson)
|
||||
|
||||
* Add support for Openslide input and DeepZoom output.
|
||||
[#146](https://github.com/lovell/sharp/issues/146)
|
||||
[@mvictoras](https://github.com/mvictoras)
|
||||
|
||||
* Allow arbitrary aspect ratios when resizing images via new `ignoreAspectRatio` method.
|
||||
[#192](https://github.com/lovell/sharp/issues/192)
|
||||
[@skedastik](https://github.com/skedastik)
|
||||
|
||||
* Enhance output image contrast by stretching its luminance to cover the full dynamic range via new `normalize` method.
|
||||
[#194](https://github.com/lovell/sharp/issues/194)
|
||||
[@bkw](https://github.com/bkw)
|
||||
[@codingforce](https://github.com/codingforce)
|
16
docs/firebase.json
Normal file
16
docs/firebase.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"hosting": {
|
||||
"site": "pixelplumbing-sharp",
|
||||
"public": "dist",
|
||||
"headers": [
|
||||
{
|
||||
"source": "**",
|
||||
"headers": [
|
||||
{ "key": "Cache-Control", "value": "max-age=86400" },
|
||||
{ "key": "X-Content-Type-Options", "value": "nosniff" },
|
||||
{ "key": "X-Frame-Options", "value": "SAMEORIGIN" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
119
docs/index.md
119
docs/index.md
@ -1,119 +0,0 @@
|
||||
# sharp
|
||||
|
||||
The typical use case for this high speed Node.js module
|
||||
is to convert large images in common formats to
|
||||
smaller, web-friendly JPEG, PNG and WebP images of varying dimensions.
|
||||
|
||||
Resizing an image is typically 4x-5x faster than using the
|
||||
quickest ImageMagick and GraphicsMagick settings.
|
||||
|
||||
Colour spaces, embedded ICC profiles and alpha transparency channels are all handled correctly.
|
||||
Lanczos resampling ensures quality is not sacrificed for speed.
|
||||
|
||||
As well as image resizing, operations such as
|
||||
rotation, extraction, compositing and gamma correction are available.
|
||||
|
||||
OS X, Windows (x64), Linux (x64, ARM) systems do not require
|
||||
the installation of any external runtime dependencies.
|
||||
|
||||
[](https://coveralls.io/r/lovell/sharp?branch=master)
|
||||
|
||||
### Formats
|
||||
|
||||
This module supports reading JPEG, PNG, WebP, TIFF, GIF and SVG images.
|
||||
|
||||
Output images can be in JPEG, PNG, WebP and TIFF formats as well as uncompressed raw pixel data.
|
||||
|
||||
Streams, Buffer objects and the filesystem can be used for input and output.
|
||||
|
||||
A single input Stream can be split into multiple processing pipelines and output Streams.
|
||||
|
||||
Deep Zoom image pyramids can be generated,
|
||||
suitable for use with "slippy map" tile viewers like
|
||||
[OpenSeadragon](https://github.com/openseadragon/openseadragon)
|
||||
and [Leaflet](https://github.com/turban/Leaflet.Zoomify).
|
||||
|
||||
### Fast
|
||||
|
||||
This module is powered by the blazingly fast
|
||||
[libvips](https://github.com/jcupitt/libvips) image processing library,
|
||||
originally created in 1989 at Birkbeck College
|
||||
and currently maintained by
|
||||
[John Cupitt](https://github.com/jcupitt).
|
||||
|
||||
Only small regions of uncompressed image data
|
||||
are held in memory and processed at a time,
|
||||
taking full advantage of multiple CPU cores and L1/L2/L3 cache.
|
||||
|
||||
Everything remains non-blocking thanks to _libuv_,
|
||||
no child processes are spawned and Promises/A+ are supported.
|
||||
|
||||
### Optimal
|
||||
|
||||
Huffman tables are optimised when generating JPEG output images
|
||||
without having to use separate command line tools like
|
||||
[jpegoptim](https://github.com/tjko/jpegoptim) and
|
||||
[jpegtran](http://jpegclub.org/jpegtran/).
|
||||
|
||||
PNG filtering can be disabled,
|
||||
which for diagrams and line art often produces the same result
|
||||
as [pngcrush](http://pmt.sourceforge.net/pngcrush/).
|
||||
|
||||
### Contributing
|
||||
|
||||
A [guide for contributors](https://github.com/lovell/sharp/blob/master/CONTRIBUTING.md)
|
||||
covers reporting bugs, requesting features and submitting code changes.
|
||||
|
||||
### Credits
|
||||
|
||||
This module would never have been possible without
|
||||
the help and code contributions of the following people:
|
||||
|
||||
* [John Cupitt](https://github.com/jcupitt)
|
||||
* [Pierre Inglebert](https://github.com/pierreinglebert)
|
||||
* [Jonathan Ong](https://github.com/jonathanong)
|
||||
* [Chanon Sajjamanochai](https://github.com/chanon)
|
||||
* [Juliano Julio](https://github.com/julianojulio)
|
||||
* [Daniel Gasienica](https://github.com/gasi)
|
||||
* [Julian Walker](https://github.com/julianwa)
|
||||
* [Amit Pitaru](https://github.com/apitaru)
|
||||
* [Brandon Aaron](https://github.com/brandonaaron)
|
||||
* [Andreas Lind](https://github.com/papandreou)
|
||||
* [Maurus Cuelenaere](https://github.com/mcuelenaere)
|
||||
* [Linus Unnebäck](https://github.com/LinusU)
|
||||
* [Victor Mateevitsi](https://github.com/mvictoras)
|
||||
* [Alaric Holloway](https://github.com/skedastik)
|
||||
* [Bernhard K. Weisshuhn](https://github.com/bkw)
|
||||
* [David A. Carley](https://github.com/dacarley)
|
||||
* [John Tobin](https://github.com/jtobinisaniceguy)
|
||||
* [Kenton Gray](https://github.com/kentongray)
|
||||
* [Felix Bünemann](https://github.com/felixbuenemann)
|
||||
* [Samy Al Zahrani](https://github.com/salzhrani)
|
||||
* [Chintan Thakkar](https://github.com/lemnisk8)
|
||||
* [F. Orlando Galashan](https://github.com/frulo)
|
||||
* [Kleis Auke Wolthuizen](https://github.com/kleisauke)
|
||||
* [Matt Hirsch](https://github.com/mhirsch)
|
||||
* [Rahul Nanwani](https://github.com/rnanwani)
|
||||
* [Matthias Thoemmes](https://github.com/cmtt)
|
||||
* [Patrick Paskaris](https://github.com/ppaskaris)
|
||||
* [Jérémy Lal](https://github.com/kapouer)
|
||||
* [Alice Monday](https://github.com/alice0meta)
|
||||
* [Kristo Jorgenson](https://github.com/kristojorg)
|
||||
* [Yves Bos](https://github.com/YvesBos)
|
||||
|
||||
Thank you!
|
||||
|
||||
### Licence
|
||||
|
||||
Copyright 2013, 2014, 2015, 2016, 2017 Lovell Fuller and contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
229
docs/install.md
229
docs/install.md
@ -1,229 +0,0 @@
|
||||
# Installation
|
||||
|
||||
```sh
|
||||
npm install sharp
|
||||
```
|
||||
|
||||
```sh
|
||||
yarn add sharp
|
||||
```
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Node v4+
|
||||
* C++11 compatible compiler such as gcc 4.8+, clang 3.0+ or MSVC 2013+
|
||||
* [node-gyp](https://github.com/TooTallNate/node-gyp#installation) and its dependencies (includes Python)
|
||||
|
||||
### Linux
|
||||
|
||||
[](https://travis-ci.org/lovell/sharp)
|
||||
[](https://circleci.com/gh/lovell/sharp)
|
||||
|
||||
libvips and its dependencies are fetched and stored within `node_modules/sharp/vendor` during `npm install`.
|
||||
This involves an automated HTTPS download of approximately 7MB.
|
||||
|
||||
Most recent Linux-based operating systems with glibc running on x64 and ARMv6+ CPUs should "just work", e.g.:
|
||||
|
||||
* Debian 7, 8
|
||||
* Ubuntu 12.04, 14.04, 16.04
|
||||
* Centos 7
|
||||
* Fedora
|
||||
* openSUSE 13.2
|
||||
* Archlinux
|
||||
* Raspbian Jessie
|
||||
* Amazon Linux 2016.03, 2016.09
|
||||
|
||||
To use a globally-installed version of libvips instead of the provided binaries,
|
||||
make sure it is at least the version listed under `config.libvips` in the `package.json` file
|
||||
and that it can be located using `pkg-config --modversion vips-cpp`.
|
||||
|
||||
If you are using non-stadard paths (anything other than `/usr` or `/usr/local`),
|
||||
you might need to set `PKG_CONFIG_PATH` during `npm install`
|
||||
and `LD_LIBRARY_PATH` at runtime.
|
||||
|
||||
This allows the use of newer versions of libvips with older versions of sharp.
|
||||
|
||||
For 32-bit Intel CPUs and older Linux-based operating systems such as Centos 6,
|
||||
it is recommended to install a system-wide installation of libvips from source:
|
||||
|
||||
https://github.com/jcupitt/libvips#building-libvips-from-a-source-tarball
|
||||
|
||||
For Linux-based operating systems such as Alpine that use musl libc,
|
||||
the smaller stack size means libvips' cache should be disabled
|
||||
via `sharp.cache(false)` to avoid a stack overflow.
|
||||
|
||||
### Mac OS
|
||||
|
||||
[](https://travis-ci.org/lovell/sharp)
|
||||
|
||||
libvips and its dependencies are fetched and stored within `node_modules/sharp/vendor` during `npm install`.
|
||||
This involves an automated HTTPS download of approximately 7MB.
|
||||
|
||||
To use your own version of libvips instead of the provided binaries, make sure it is
|
||||
at least the version listed under `config.libvips` in the `package.json` file and
|
||||
that it can be located using `pkg-config --modversion vips-cpp`.
|
||||
|
||||
### Windows x64
|
||||
|
||||
[](https://ci.appveyor.com/project/lovell/sharp)
|
||||
|
||||
libvips and its dependencies are fetched and stored within `node_modules\sharp\vendor` during `npm install`.
|
||||
This involves an automated HTTPS download of approximately 11MB.
|
||||
|
||||
Only 64-bit (x64) `node.exe` is supported.
|
||||
|
||||
### FreeBSD
|
||||
|
||||
libvips must be installed before `npm install` is run.
|
||||
This can be achieved via [FreshPorts](https://www.freshports.org/graphics/vips/):
|
||||
|
||||
```sh
|
||||
cd /usr/ports/graphics/vips/ && make install clean
|
||||
```
|
||||
|
||||
### Heroku
|
||||
|
||||
libvips and its dependencies are fetched and stored within `node_modules\sharp\vendor` during `npm install`.
|
||||
This involves an automated HTTPS download of approximately 7MB.
|
||||
|
||||
Set [NODE_MODULES_CACHE](https://devcenter.heroku.com/articles/nodejs-support#cache-behavior)
|
||||
to `false` when using the `yarn` package manager.
|
||||
|
||||
### Docker
|
||||
|
||||
[Marc Bachmann](https://github.com/marcbachmann) maintains an
|
||||
[Ubuntu-based Dockerfile for libvips](https://github.com/marcbachmann/dockerfile-libvips).
|
||||
|
||||
```sh
|
||||
docker pull marcbachmann/libvips
|
||||
```
|
||||
|
||||
[Will Jordan](https://github.com/wjordan) maintains an
|
||||
[Alpine-based Dockerfile for libvips](https://github.com/wjordan/dockerfile-libvips).
|
||||
|
||||
```sh
|
||||
docker pull wjordan/libvips
|
||||
```
|
||||
|
||||
[Tailor Brands](https://github.com/TailorBrands) maintain
|
||||
[Debian-based Dockerfiles for libvips and nodejs](https://github.com/TailorBrands/docker-libvips).
|
||||
|
||||
```sh
|
||||
docker pull tailor/docker-libvips
|
||||
```
|
||||
|
||||
### AWS Lambda
|
||||
|
||||
In order to use sharp on AWS Lambda, you need to [create a deployment package](http://docs.aws.amazon.com/lambda/latest/dg/nodejs-create-deployment-pkg.html). Because sharp
|
||||
downloads and links libraries for the current platform during `npm install` you have to
|
||||
do this on a system similar to the [Lambda Execution Environment](http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html). The easiest ways to do this, is to setup a
|
||||
small t2.micro instance using the AMI ID listed in the previous link, ssh into it as ec2-user
|
||||
and follow the instructions below.
|
||||
|
||||
Install dependencies:
|
||||
|
||||
```sh
|
||||
curl -s https://rpm.nodesource.com/setup_4.x | sudo bash -
|
||||
sudo yum install -y gcc-c++ nodejs
|
||||
```
|
||||
|
||||
Copy your code and package.json to the instance using `scp` and create a deployment package:
|
||||
|
||||
```sh
|
||||
cd sharp-lambda-example
|
||||
npm install
|
||||
zip -ur9 ../sharp-lambda-example.zip index.js node_modules
|
||||
```
|
||||
|
||||
You can now download your deployment ZIP using `scp` and upload it to Lambda. Be sure to set your Lambda runtime to Node.js 4.3.
|
||||
|
||||
**Performance Tip:** To get the best performance on Lambda choose the largest memory available because this also gives you the most cpu time (a 1536 MB function is 12x faster than a 128 MB function).
|
||||
|
||||
### Build tools
|
||||
|
||||
* [gulp-responsive](https://www.npmjs.com/package/gulp-responsive)
|
||||
* [grunt-sharp](https://www.npmjs.com/package/grunt-sharp)
|
||||
|
||||
### CLI tools
|
||||
|
||||
* [sharp-cli](https://www.npmjs.com/package/sharp-cli)
|
||||
|
||||
### Security
|
||||
|
||||
Many users of this module process untrusted, user-supplied images,
|
||||
but there are aspects of security to consider when doing so.
|
||||
|
||||
It is possible to compile libvips with support for various third-party image loaders.
|
||||
Each of these libraries has undergone differing levels of security testing.
|
||||
|
||||
Whilst tools such as [American Fuzzy Lop](http://lcamtuf.coredump.cx/afl/)
|
||||
and [Valgrind](http://valgrind.org/) have been used to test
|
||||
the most popular web-based formats, as well as libvips itself,
|
||||
you are advised to perform your own testing and sandboxing.
|
||||
|
||||
ImageMagick in particular has a relatively large attack surface,
|
||||
which can be partially mitigated with a
|
||||
[policy.xml](http://www.imagemagick.org/script/resources.php)
|
||||
configuration file to prevent the use of coders known to be vulnerable.
|
||||
|
||||
```xml
|
||||
<policymap>
|
||||
<policy domain="coder" rights="none" pattern="EPHEMERAL" />
|
||||
<policy domain="coder" rights="none" pattern="URL" />
|
||||
<policy domain="coder" rights="none" pattern="HTTPS" />
|
||||
<policy domain="coder" rights="none" pattern="MVG" />
|
||||
<policy domain="coder" rights="none" pattern="MSL" />
|
||||
<policy domain="coder" rights="none" pattern="TEXT" />
|
||||
<policy domain="coder" rights="none" pattern="SHOW" />
|
||||
<policy domain="coder" rights="none" pattern="WIN" />
|
||||
<policy domain="coder" rights="none" pattern="PLT" />
|
||||
</policymap>
|
||||
```
|
||||
|
||||
Set the `MAGICK_CONFIGURE_PATH` environment variable
|
||||
to the directory containing the `policy.xml` file.
|
||||
|
||||
### Licences
|
||||
|
||||
If a global installation of libvips that meets the
|
||||
minimum version requirement cannot be found,
|
||||
this module will download a pre-compiled bundle of libvips
|
||||
and its dependencies on Linux and Windows machines.
|
||||
|
||||
Should you need to manually download and inspect these files,
|
||||
you can do so via https://dl.bintray.com/lovell/sharp/
|
||||
|
||||
This module is licensed under the terms of the
|
||||
[Apache 2.0 Licence](https://github.com/lovell/sharp/blob/master/LICENSE).
|
||||
|
||||
The libraries downloaded and used by this module
|
||||
are done so under the terms of the following licences,
|
||||
all of which are compatible with the Apache 2.0 Licence.
|
||||
|
||||
Use of libraries under the terms of the LGPLv3 is via the
|
||||
"any later version" clause of the LGPLv2 or LGPLv2.1.
|
||||
|
||||
| Library | Used under the terms of |
|
||||
|---------------|----------------------------------------------------------------------------------------------------------|
|
||||
| cairo | Mozilla Public License 2.0 |
|
||||
| expat | MIT Licence |
|
||||
| fontconfig | [fontconfig Licence](https://cgit.freedesktop.org/fontconfig/tree/COPYING) (BSD-like) |
|
||||
| freetype | [freetype Licence](http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT) (BSD-like) |
|
||||
| giflib | MIT Licence |
|
||||
| glib | LGPLv3 |
|
||||
| harfbuzz | MIT Licence |
|
||||
| lcms | MIT Licence |
|
||||
| libcroco | LGPLv3 |
|
||||
| libexif | LGPLv3 |
|
||||
| libffi | MIT Licence |
|
||||
| libgsf | LGPLv3 |
|
||||
| libjpeg-turbo | [zlib License, IJG License](https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/LICENSE.md) |
|
||||
| libpng | [libpng License](http://www.libpng.org/pub/png/src/libpng-LICENSE.txt) |
|
||||
| librsvg | LGPLv3 |
|
||||
| libtiff | [libtiff License](http://www.libtiff.org/misc.html) (BSD-like) |
|
||||
| libvips | LGPLv3 |
|
||||
| libwebp | New BSD License |
|
||||
| libxml2 | MIT Licence |
|
||||
| pango | LGPLv3 |
|
||||
| pixman | MIT Licence |
|
||||
| zlib | [zlib Licence](https://github.com/madler/zlib/blob/master/zlib.h) |
|
18
docs/package.json
Normal file
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,73 +0,0 @@
|
||||
# Performance
|
||||
|
||||
### Test environment
|
||||
|
||||
* AWS EC2 eu-central-1 [c4.xlarge](http://aws.amazon.com/ec2/instance-types/#c4) (4x E5-2666 v3 @ 2.90GHz)
|
||||
* Ubuntu 16.04.1 LTS (HVM, SSD, 20161115, ami-82cf0aed)
|
||||
* Node.js v6.9.1
|
||||
|
||||
### The contenders
|
||||
|
||||
* [jimp](https://www.npmjs.com/package/jimp) v0.2.27 - Image processing in pure JavaScript. Bilinear interpolation only.
|
||||
* [lwip](https://www.npmjs.com/package/lwip) v0.0.9 - Wrapper around CImg. Compiles outdated, insecure dependencies from source.
|
||||
* [mapnik](https://www.npmjs.org/package/mapnik) v3.5.14 - Whilst primarily a map renderer, Mapnik contains bitmap image utilities.
|
||||
* [imagemagick-native](https://www.npmjs.com/package/imagemagick-native) v1.9.3 - Wrapper around libmagick++, supports Buffers only.
|
||||
* [imagemagick](https://www.npmjs.com/package/imagemagick) v0.1.3 - Supports filesystem only and "*has been unmaintained for a long time*".
|
||||
* [gm](https://www.npmjs.com/package/gm) v1.23.0 - Fully featured wrapper around GraphicsMagick's `gm` command line utility.
|
||||
* sharp v0.17.0 / libvips v8.4.2 - Caching within libvips disabled to ensure a fair comparison.
|
||||
|
||||
### The task
|
||||
|
||||
Decompress a 2725x2225 JPEG image,
|
||||
resize to 720x588 using Lanczos 3 resampling (where available),
|
||||
then compress to JPEG at a "quality" setting of 80.
|
||||
|
||||
### Results
|
||||
|
||||
| Module | Input | Output | Ops/sec | Speed-up |
|
||||
| :----------------- | :----- | :----- | ------: | -------: |
|
||||
| jimp (bilinear) | buffer | buffer | 1.06 | 1.0 |
|
||||
| lwip | buffer | buffer | 1.87 | 1.8 |
|
||||
| mapnik | buffer | buffer | 2.91 | 2.7 |
|
||||
| imagemagick-native | buffer | buffer | 4.03 | 3.8 |
|
||||
| imagemagick | file | file | 7.10 | 6.7 |
|
||||
| gm | buffer | buffer | 7.08 | 6.7 |
|
||||
| gm | file | file | 7.10 | 6.7 |
|
||||
| sharp | stream | stream | 27.61 | 26.0 |
|
||||
| sharp | file | file | 28.41 | 26.8 |
|
||||
| sharp | buffer | file | 28.71 | 27.1 |
|
||||
| sharp | file | buffer | 28.60 | 27.0 |
|
||||
| sharp | buffer | buffer | 29.08 | 27.4 |
|
||||
|
||||
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.
|
||||
|
||||
### Benchmark test prerequisites
|
||||
|
||||
Requires both _ImageMagick_ and _GraphicsMagick_:
|
||||
|
||||
```sh
|
||||
brew install imagemagick
|
||||
brew install graphicsmagick
|
||||
```
|
||||
|
||||
```sh
|
||||
sudo apt-get install imagemagick libmagick++-dev graphicsmagick
|
||||
```
|
||||
|
||||
```sh
|
||||
sudo yum install ImageMagick-devel ImageMagick-c++-devel GraphicsMagick
|
||||
```
|
||||
|
||||
### Running the benchmark test
|
||||
|
||||
```sh
|
||||
git clone https://github.com/lovell/sharp.git
|
||||
cd sharp
|
||||
npm install
|
||||
cd test/bench
|
||||
npm install
|
||||
npm test
|
||||
```
|
61
docs/public/api-resize-fit.svg
Normal file
61
docs/public/api-resize-fit.svg
Normal file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="998" height="243" viewBox="0 0 998 243">
|
||||
<defs>
|
||||
<g id="placeholder">
|
||||
<rect width="180" height="128" fill="#64bed8"/>
|
||||
<circle cx="61.1" cy="36.8" r="19.3" fill="#ffefa9"/>
|
||||
<circle cx="61.1" cy="36.8" r="18.1" fill="#fdda42"/>
|
||||
<path d="m67.2 34.7 15.2 46L90 57.9l30.4 38 7.8-15.2 7.5 15.4H44z" fill="#6a696f"/>
|
||||
<path d="m82.4 80.7-15.2-46-.3 69h22.9z" fill="#474749"/>
|
||||
<path d="m90.1 58 12.2 15 18.2 23-13.9.1z" fill="#474749"/>
|
||||
<path d="M135.8 96H131l-2.8-15.3z" fill="#474749"/>
|
||||
<path d="M35.2 96h107.1c0 1.7-1.4 3.2-3.2 3.2H38.4a3.2 3.2 0 0 1-3.2-3.2z" fill="#b9c861"/>
|
||||
<path d="m67.2 34.7-.1 31-6.2-3-5.3 2.7z" fill="#fff"/>
|
||||
<path d="m67.2 34.7 7.6 23-7.7 8z" fill="#b3b1b4"/>
|
||||
<rect width="30.8" height="7.7" x="71.1" y="27.2" rx="2.8" ry="4.1" fill="#fff"/>
|
||||
<rect width="30.8" height="7.7" x="82.2" y="34.8" rx="2.8" ry="4.1" fill="#fff"/>
|
||||
<rect width="30.8" height="7.7" x="36.2" y="19.6" rx="2.8" ry="4.1" fill="#fff"/>
|
||||
<path d="m89.6 72.8-7.2 7.9L90 57.9l10 23z" fill="#fff"/>
|
||||
<path d="m90.1 58 10 23 2.2-8z" fill="#b3b1b4"/>
|
||||
<path d="M131.2 85.2 137 68l9 17.2-8 6z" fill="#8da128"/>
|
||||
<rect width="109.4" height="6.8" x="33.9" y="99.1" rx="13.2" ry="11.4" fill="#22b0d6"/>
|
||||
<path d="m137 68-5.8 17.2 6.8 6.1.3-13.7z" fill="#727d2e"/>
|
||||
<rect width="83.3" height="6.8" x="50.8" y="103.6" rx="10" ry="11.4" fill="#22b0d6"/>
|
||||
<rect width=".7" height="18.4" x="138" y="77.6" fill="#585657"/>
|
||||
<rect width=".5" height="5.2" x="2" y="-161.3" fill="#585657" transform="rotate(120)"/>
|
||||
<rect width=".5" height="5.3" x="5.5" y="-163.3" fill="#585657" transform="rotate(120)"/>
|
||||
<rect width=".5" height="4.8" x="-142.4" y="77.7" fill="#585657" transform="rotate(240)"/>
|
||||
<rect width=".5" height="5.1" x="-146" y="75.6" fill="#585657" transform="rotate(240)"/>
|
||||
</g>
|
||||
<pattern id="img" height="100%" width="100%" viewBox="0 0 180 128">
|
||||
<use xlink:href="#placeholder"/>
|
||||
</pattern>
|
||||
<pattern id="img-fill" width="100%" height="100%" viewBox="0 0 180 128" preserveAspectRatio="none">
|
||||
<use xlink:href="#placeholder"/>
|
||||
</pattern>
|
||||
</defs>
|
||||
<rect x="0" y="0" width="998" height="243" fill="#ddd"/>
|
||||
<g id="cover">
|
||||
<rect x="22" y="28" width="180" height="132" fill="url(#img)"/>
|
||||
<rect x="48" y="30" width="128" height="128" fill="none" stroke="#000" stroke-width="4"/>
|
||||
<text x="112" y="85%" dominant-baseline="middle" text-anchor="middle" font-family="sans" font-size="32" font-weight="bold">cover</text>
|
||||
</g>
|
||||
<g id="contain">
|
||||
<rect x="240" y="30" width="128" height="128" fill="url(#img)" stroke="#000" stroke-width="4"/>
|
||||
<text x="304" y="85%" dominant-baseline="middle" text-anchor="middle" font-family="sans" font-size="32" font-weight="bold" fill="#555">contain</text>
|
||||
</g>
|
||||
<g id="fill">
|
||||
<rect x="432" y="30" width="128" height="128" fill="url(#img-fill)" stroke="#000" stroke-width="4"/>
|
||||
<text x="496" y="85%" dominant-baseline="middle" text-anchor="middle" font-family="sans" font-size="32" font-weight="bold">fill</text>
|
||||
</g>
|
||||
<g id="inside">
|
||||
<rect x="624" y="48" width="128" height="92" fill="url(#img)" stroke="#000" stroke-width="4"/>
|
||||
<rect x="624" y="30" width="128" height="128" fill="none" stroke="#000" stroke-width="4" stroke-dasharray="12 4" stroke-dashoffset="6"/>
|
||||
<text x="688" y="85%" dominant-baseline="middle" text-anchor="middle" font-family="sans" font-size="32" font-weight="bold" fill="#555">inside</text>
|
||||
</g>
|
||||
<g id="outside">
|
||||
<rect x="792" y="30" width="176" height="128" fill="url(#img)" stroke="#000" stroke-width="4"/>
|
||||
<rect x="816" y="30" width="128" height="128" fill="none" stroke="#000" stroke-width="4" stroke-dasharray="12 4" stroke-dashoffset="-2"/>
|
||||
<text x="880" y="85%" dominant-baseline="middle" text-anchor="middle" font-family="sans" font-size="32" font-weight="bold">outside</text>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.0 KiB |
5
docs/public/favicon.svg
Normal file
5
docs/public/favicon.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 |
325
docs/public/humans.txt
Normal file
325
docs/public/humans.txt
Normal file
@ -0,0 +1,325 @@
|
||||
/* THANKS */
|
||||
|
||||
Name: John Cupitt
|
||||
GitHub: https://github.com/jcupitt
|
||||
|
||||
Name: Pierre Inglebert
|
||||
GitHub: https://github.com/pierreinglebert
|
||||
|
||||
Name: Jonathan Ong
|
||||
GitHub: https://github.com/jonathanong
|
||||
|
||||
Name: Chanon Sajjamanochai
|
||||
GitHub: https://github.com/chanon
|
||||
|
||||
Name: Juliano Julio
|
||||
GitHub: https://github.com/julianojulio
|
||||
|
||||
Name: Daniel Gasienica
|
||||
GitHub: https://github.com/gasi
|
||||
|
||||
Name: Julian Walker
|
||||
GitHub: https://github.com/julianwa
|
||||
|
||||
Name: Amit Pitaru
|
||||
GitHub: https://github.com/apitaru
|
||||
|
||||
Name: Brandon Aaron
|
||||
GitHub: https://github.com/brandonaaron
|
||||
|
||||
Name: Andreas Lind
|
||||
GitHub: https://github.com/papandreou
|
||||
|
||||
Name: Maurus Cuelenaere
|
||||
GitHub: https://github.com/mcuelenaere
|
||||
|
||||
Name: Linus Unnebäck
|
||||
GitHub: https://github.com/LinusU
|
||||
|
||||
Name: Victor Mateevitsi
|
||||
GitHub: https://github.com/mvictoras
|
||||
|
||||
Name: Alaric Holloway
|
||||
GitHub: https://github.com/skedastik
|
||||
|
||||
Name: Bernhard K. Weisshuhn
|
||||
GitHub: https://github.com/bkw
|
||||
|
||||
Name: David A. Carley
|
||||
GitHub: https://github.com/dacarley
|
||||
|
||||
Name: John Tobin
|
||||
GitHub: https://github.com/jtobinisaniceguy
|
||||
|
||||
Name: Kenton Gray
|
||||
GitHub: https://github.com/kentongray
|
||||
|
||||
Name: Felix Bünemann
|
||||
GitHub: https://github.com/felixbuenemann
|
||||
|
||||
Name: Samy Al Zahrani
|
||||
GitHub: https://github.com/salzhrani
|
||||
|
||||
Name: Chintan Thakkar
|
||||
GitHub: https://github.com/lemnisk8
|
||||
|
||||
Name: F. Orlando Galashan
|
||||
GitHub: https://github.com/frulo
|
||||
|
||||
Name: Kleis Auke Wolthuizen
|
||||
GitHub: https://github.com/kleisauke
|
||||
|
||||
Name: Matt Hirsch
|
||||
GitHub: https://github.com/mhirsch
|
||||
|
||||
Name: Rahul Nanwani
|
||||
GitHub: https://github.com/rnanwani
|
||||
|
||||
Name: Matthias Thoemmes
|
||||
GitHub: https://github.com/cmtt
|
||||
|
||||
Name: Patrick Paskaris
|
||||
GitHub: https://github.com/ppaskaris
|
||||
|
||||
Name: Jérémy Lal
|
||||
GitHub: https://github.com/kapouer
|
||||
|
||||
Name: Alice Monday
|
||||
GitHub: https://github.com/alice0meta
|
||||
|
||||
Name: Kristo Jorgenson
|
||||
GitHub: https://github.com/kristojorg
|
||||
|
||||
Name: Yves Bos
|
||||
GitHub: https://github.com/YvesBos
|
||||
|
||||
Name: Nicolas Coden
|
||||
GitHub: https://github.com/ncoden
|
||||
|
||||
Name: Matt Parrish
|
||||
GitHub: https://github.com/pbomb
|
||||
|
||||
Name: Matthew McEachen
|
||||
GitHub: https://github.com/mceachen
|
||||
|
||||
Name: Jarda Kotěšovec
|
||||
GitHub: https://github.com/jardakotesovec
|
||||
|
||||
Name: Kenric D'Souza
|
||||
GitHub: https://github.com/AzureByte
|
||||
|
||||
Name: Oleh Aleinyk
|
||||
GitHub: https://github.com/oaleynik
|
||||
|
||||
Name: Marcel Bretschneider
|
||||
GitHub: https://github.com/3epnm
|
||||
|
||||
Name: Andrea Bianco
|
||||
GitHub: https://github.com/BiancoA
|
||||
|
||||
Name: Rik Heywood
|
||||
GitHub: https://github.com/rikh42
|
||||
|
||||
Name: Thomas Parisot
|
||||
GitHub: https://github.com/oncletom
|
||||
|
||||
Name: Nathan Graves
|
||||
GitHub: https://github.com/woolite64
|
||||
|
||||
Name: Tom Lokhorst
|
||||
GitHub: https://github.com/tomlokhorst
|
||||
|
||||
Name: Espen Hovlandsdal
|
||||
GitHub: https://github.com/rexxars
|
||||
|
||||
Name: Sylvain Dumont
|
||||
GitHub: https://github.com/sylvaindumont
|
||||
|
||||
Name: Alun Davies
|
||||
GitHub: https://github.com/alundavies
|
||||
|
||||
Name: Aidan Hoolachan
|
||||
GitHub: https://github.com/ajhool
|
||||
|
||||
Name: Axel Eirola
|
||||
GitHub: https://github.com/aeirola
|
||||
|
||||
Name: Freezy
|
||||
GitHub: https://github.com/freezy
|
||||
|
||||
Name: Julian Aubourg
|
||||
GitHub: https://github.com/jaubourg
|
||||
|
||||
Name: Keith Belovay
|
||||
GitHub: https://github.com/fromkeith
|
||||
|
||||
Name: Michael B. Klein
|
||||
GitHub: https://github.com/mbklein
|
||||
|
||||
Name: Jakub Michálek
|
||||
GitHub: https://github.com/Goues
|
||||
|
||||
Name: Ilya Ovdin
|
||||
GitHub: https://github.com/iovdin
|
||||
|
||||
Name: Andargor
|
||||
GitHub: https://github.com/Andargor
|
||||
|
||||
Name: Nicolas Stepien
|
||||
GitHub: https://github.com/MayhemYDG
|
||||
|
||||
Name: Paul Neave
|
||||
GitHub: https://github.com/neave
|
||||
|
||||
Name: Brendan Kennedy
|
||||
GitHub: https://github.com/rustyguts
|
||||
|
||||
Name: Brychan Bennett-Odlum
|
||||
GitHub: https://github.com/BrychanOdlum
|
||||
|
||||
Name: Edward Silverton
|
||||
GitHub: https://github.com/edsilv
|
||||
|
||||
Name: Dumitru Deveatii
|
||||
GitHub: https://github.com/dimadeveatii
|
||||
|
||||
Name: Roland Asmann
|
||||
GitHub: https://github.com/malice00
|
||||
|
||||
Name: Roman Malieiev
|
||||
GitHub: https://github.com/romaleev
|
||||
|
||||
Name: Jerome Vouillon
|
||||
GitHub: https://github.com/vouillon
|
||||
|
||||
Name: Tomáš Szabo
|
||||
GitHub: https://github.com/deftomat
|
||||
|
||||
Name: Robert O'Rourke
|
||||
GitHub: https://github.com/roborourke
|
||||
|
||||
Name: Denis Soldatov
|
||||
GitHub: https://github.com/derom
|
||||
|
||||
Name: Stefan Probst
|
||||
GitHub: https://github.com/stefanprobst
|
||||
|
||||
Name: Thomas Beiganz
|
||||
GitHub: https://github.com/beig
|
||||
|
||||
Name: Florian Busch
|
||||
GitHub: https://github.com/florian-busch
|
||||
|
||||
Name: Matthieu Salettes
|
||||
GitHub: https://github.com/msalettes
|
||||
|
||||
Name: Taneli Vatanen
|
||||
GitHub: https://github.com/Daiz
|
||||
|
||||
Name: Mart Jansink
|
||||
GitHub: https://github.com/mart-jansink
|
||||
|
||||
Name: Tenpi
|
||||
GitHub: https://github.com/Tenpi
|
||||
|
||||
Name: Zaruike
|
||||
GitHub: https://github.com/Zaruike
|
||||
|
||||
Name: Erlend F
|
||||
GitHub: https://github.com/erf
|
||||
|
||||
Name: Drian Naude
|
||||
GitHub: https://github.com/driannaude
|
||||
|
||||
Name: Max Gordon
|
||||
GitHub: https://github.com/gforge
|
||||
|
||||
Name: Chris Banks
|
||||
GitHub: https://github.com/christopherbradleybanks
|
||||
|
||||
Name: codepage949
|
||||
GitHub: https://github.com/codepage949
|
||||
|
||||
Name: Chris Hranj
|
||||
GitHub: https://github.com/Brodan
|
||||
|
||||
Name: Ankur Parihar
|
||||
GitHub: https://github.com/ankurparihar
|
||||
|
||||
Name: Joona Heinikoski
|
||||
GitHub: https://github.com/joonamo
|
||||
|
||||
Name: AlexanderTheGrey
|
||||
GitHub: https://github.com/AlexanderTheGrey
|
||||
|
||||
Name: Blayne Chard
|
||||
GitHub: https://github.com/blacha
|
||||
|
||||
Name: Brahim
|
||||
GitHub: https://github.com/brahima
|
||||
|
||||
Name: Anton Marsden
|
||||
GitHub: https://github.com/antonmarsden
|
||||
|
||||
Name: Marcos Casagrande
|
||||
GitHub: https://github.com/marcosc90
|
||||
|
||||
Name: Emanuel Jöbstl
|
||||
GitHub: https://github.com/ejoebstl
|
||||
|
||||
Name: Tomasz Janowski
|
||||
GitHub: https://github.com/janaz
|
||||
|
||||
Name: Lachlan Newman
|
||||
GitHub: https://github.com/LachlanNewman
|
||||
|
||||
Name: BJJ
|
||||
GitHub: https://github.com/bianjunjie1981
|
||||
|
||||
Name: Dennis Beatty
|
||||
GitHub: https://github.com/dnsbty
|
||||
|
||||
Name: Ingvar Stepanyan
|
||||
GitHub: https://github.com/RReverser
|
||||
|
||||
Name: Tamás András Horváth
|
||||
GitHub: https://github.com/icetee
|
||||
|
||||
Name: Aaron Che
|
||||
GitHub: https://github.com/yolopunk
|
||||
|
||||
Name: Mert Alev
|
||||
GitHub: https://github.com/mertalev
|
||||
|
||||
Name: Adriaan Meuris
|
||||
GitHub: https://github.com/adriaanmeuris
|
||||
|
||||
Name: Richard Hillmann
|
||||
GitHub: https://github.com/project0
|
||||
|
||||
Name: Pongsatorn Manusopit
|
||||
GitHub: https://github.com/ton11797
|
||||
|
||||
Name: Nathan Keynes
|
||||
GitHub: https://github.com/nkeynes
|
||||
|
||||
Name: Sumit D
|
||||
GitHub: https://github.com/sumitd2
|
||||
|
||||
Name: Caleb Meredith
|
||||
GitHub: https://github.com/calebmer
|
||||
|
||||
Name: Don Denton
|
||||
GitHub: https://github.com/happycollision
|
||||
|
||||
Name: Florent Zabera
|
||||
GitHub: https://github.com/florentzabera
|
||||
|
||||
Name: Quentin Pinçon
|
||||
GitHub: https://github.com/qpincon
|
||||
|
||||
Name: Hans Chen
|
||||
GitHub: https://github.com/hans00
|
||||
|
||||
Name: Thibaut Patel
|
||||
GitHub: https://github.com/tpatel
|
4
docs/public/robots.txt
Normal file
4
docs/public/robots.txt
Normal file
@ -0,0 +1,4 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
|
||||
Sitemap: https://sharp.pixelplumbing.com/sitemap-index.xml
|
11
docs/public/sharp-logo-mono.svg
Normal file
11
docs/public/sharp-logo-mono.svg
Normal file
@ -0,0 +1,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="86 86 550 550">
|
||||
<!-- Creative Commons CC0 1.0 Universal Public Domain Dedication -->
|
||||
<defs>
|
||||
<mask id="c">
|
||||
<path fill="none" stroke="#fff" stroke-width="80" d="M258.411 285.777l200.176-26.8M244.113 466.413L451.44 438.66m.001 0V238.484m0-150.121v171.572l178.725-23.917m-359.843 19.584V477.22m2.387 156.95V462.591L93.984 486.515"/>
|
||||
<path fill="none" stroke="#000" stroke-width="112" d="M451.441 610.246V438.66l178.725-23.91M269.688 112.59v171.58L90.964 308.093"/>
|
||||
</mask>
|
||||
</defs>
|
||||
<path mask="url(#c)" fill="none" stroke="#000" stroke-width="80" d="M258.411 285.777l200.176-26.8M244.113 466.413L451.44 438.66m.001 0V238.484m0-150.121v171.572l178.725-23.917m-359.843 19.584V477.22m2.387 156.95V462.591L93.984 486.515"/>
|
||||
<path fill="none" stroke="#000" stroke-width="80" d="M451.441 610.246V438.66l178.725-23.91M269.688 112.59v171.58L90.964 308.093"/>
|
||||
</svg>
|
After Width: | Height: | Size: 929 B |
5
docs/public/sharp-logo.svg
Normal file
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 |
5
docs/src/assets/sharp-logo.svg
Normal file
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
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() })
|
||||
};
|
141
docs/src/content/docs/api-channel.md
Normal file
141
docs/src/content/docs/api-channel.md
Normal file
@ -0,0 +1,141 @@
|
||||
---
|
||||
# This file was auto-generated from JSDoc in lib/channel.js
|
||||
title: Channel manipulation
|
||||
---
|
||||
|
||||
## removeAlpha
|
||||
> removeAlpha() ⇒ <code>Sharp</code>
|
||||
|
||||
Remove alpha channels, if any. This is a no-op if the image does not have an alpha channel.
|
||||
|
||||
See also [flatten](/api-operation#flatten).
|
||||
|
||||
|
||||
**Example**
|
||||
```js
|
||||
sharp('rgba.png')
|
||||
.removeAlpha()
|
||||
.toFile('rgb.png', function(err, info) {
|
||||
// rgb.png is a 3 channel image without an alpha channel
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## ensureAlpha
|
||||
> ensureAlpha([alpha]) ⇒ <code>Sharp</code>
|
||||
|
||||
Ensure the output image has an alpha transparency channel.
|
||||
If missing, the added alpha channel will have the specified
|
||||
transparency level, defaulting to fully-opaque (1).
|
||||
This is a no-op if the image already has an alpha channel.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid alpha transparency level
|
||||
|
||||
**Since**: 0.21.2
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [alpha] | <code>number</code> | <code>1</code> | alpha transparency level (0=fully-transparent, 1=fully-opaque) |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// rgba.png will be a 4 channel image with a fully-opaque alpha channel
|
||||
await sharp('rgb.jpg')
|
||||
.ensureAlpha()
|
||||
.toFile('rgba.png')
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// rgba is a 4 channel image with a fully-transparent alpha channel
|
||||
const rgba = await sharp(rgb)
|
||||
.ensureAlpha(0)
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## extractChannel
|
||||
> extractChannel(channel) ⇒ <code>Sharp</code>
|
||||
|
||||
Extract a single channel from a multi-channel image.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid channel
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| channel | <code>number</code> \| <code>string</code> | zero-indexed channel/band number to extract, or `red`, `green`, `blue` or `alpha`. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// green.jpg is a greyscale image containing the green channel of the input
|
||||
await sharp(input)
|
||||
.extractChannel('green')
|
||||
.toFile('green.jpg');
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// red1 is the red value of the first pixel, red2 the second pixel etc.
|
||||
const [red1, red2, ...] = await sharp(input)
|
||||
.extractChannel(0)
|
||||
.raw()
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## joinChannel
|
||||
> joinChannel(images, options) ⇒ <code>Sharp</code>
|
||||
|
||||
Join one or more channels to the image.
|
||||
The meaning of the added channels depends on the output colourspace, set with `toColourspace()`.
|
||||
By default the output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
||||
Channel ordering follows vips convention:
|
||||
- sRGB: 0: Red, 1: Green, 2: Blue, 3: Alpha.
|
||||
- CMYK: 0: Magenta, 1: Cyan, 2: Yellow, 3: Black, 4: Alpha.
|
||||
|
||||
Buffers may be any of the image formats supported by sharp.
|
||||
For raw pixel input, the `options` object should contain a `raw` attribute, which follows the format of the attribute of the same name in the `sharp()` constructor.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| images | <code>Array.<(string\|Buffer)></code> \| <code>string</code> \| <code>Buffer</code> | one or more images (file paths, Buffers). |
|
||||
| options | <code>Object</code> | image options, see `sharp()` constructor. |
|
||||
|
||||
|
||||
|
||||
## bandbool
|
||||
> bandbool(boolOp) ⇒ <code>Sharp</code>
|
||||
|
||||
Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| boolOp | <code>string</code> | one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
sharp('3-channel-rgb-input.png')
|
||||
.bandbool(sharp.bool.and)
|
||||
.toFile('1-channel-output.png', function (err, info) {
|
||||
// The output will be a single channel image where each pixel `P = R & G & B`.
|
||||
// If `I(1,1) = [247, 170, 14] = [0b11110111, 0b10101010, 0b00001111]`
|
||||
// then `O(1,1) = 0b11110111 & 0b10101010 & 0b00001111 = 0b00000010 = 2`.
|
||||
});
|
||||
```
|
150
docs/src/content/docs/api-colour.md
Normal file
150
docs/src/content/docs/api-colour.md
Normal file
@ -0,0 +1,150 @@
|
||||
---
|
||||
# This file was auto-generated from JSDoc in lib/colour.js
|
||||
title: Colour manipulation
|
||||
---
|
||||
|
||||
## 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.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameter
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| tint | <code>string</code> \| <code>Object</code> | Parsed by the [color](https://www.npmjs.org/package/color) module. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input)
|
||||
.tint({ r: 255, g: 240, b: 16 })
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## greyscale
|
||||
> greyscale([greyscale]) ⇒ <code>Sharp</code>
|
||||
|
||||
Convert to 8-bit greyscale; 256 shades of grey.
|
||||
This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
|
||||
By default the output image will be web-friendly sRGB and contain three (identical) colour channels.
|
||||
This may be overridden by other sharp operations such as `toColourspace('b-w')`,
|
||||
which will produce an output image containing one colour channel.
|
||||
An alpha channel may be present, and will be unchanged by the operation.
|
||||
|
||||
|
||||
|
||||
| Param | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| [greyscale] | <code>Boolean</code> | <code>true</code> |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input).greyscale().toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## grayscale
|
||||
> grayscale([grayscale]) ⇒ <code>Sharp</code>
|
||||
|
||||
Alternative spelling of `greyscale`.
|
||||
|
||||
|
||||
|
||||
| Param | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| [grayscale] | <code>Boolean</code> | <code>true</code> |
|
||||
|
||||
|
||||
|
||||
## pipelineColourspace
|
||||
> pipelineColourspace([colourspace]) ⇒ <code>Sharp</code>
|
||||
|
||||
Set the pipeline colourspace.
|
||||
|
||||
The input image will be converted to the provided colourspace at the start of the pipeline.
|
||||
All operations will use this colourspace before converting to the output colourspace,
|
||||
as defined by [toColourspace](#tocolourspace).
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
**Since**: 0.29.0
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [colourspace] | <code>string</code> | pipeline colourspace e.g. `rgb16`, `scrgb`, `lab`, `grey16` [...](https://github.com/libvips/libvips/blob/41cff4e9d0838498487a00623462204eb10ee5b8/libvips/iofuncs/enumtypes.c#L774) |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// Run pipeline in 16 bits per channel RGB while converting final result to 8 bits per channel sRGB.
|
||||
await sharp(input)
|
||||
.pipelineColourspace('rgb16')
|
||||
.toColourspace('srgb')
|
||||
.toFile('16bpc-pipeline-to-8bpc-output.png')
|
||||
```
|
||||
|
||||
|
||||
## pipelineColorspace
|
||||
> pipelineColorspace([colorspace]) ⇒ <code>Sharp</code>
|
||||
|
||||
Alternative spelling of `pipelineColourspace`.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [colorspace] | <code>string</code> | pipeline colorspace. |
|
||||
|
||||
|
||||
|
||||
## toColourspace
|
||||
> toColourspace([colourspace]) ⇒ <code>Sharp</code>
|
||||
|
||||
Set the output colourspace.
|
||||
By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [colourspace] | <code>string</code> | output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://github.com/libvips/libvips/blob/3c0bfdf74ce1dc37a6429bed47fa76f16e2cd70a/libvips/iofuncs/enumtypes.c#L777-L794) |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// Output 16 bits per pixel RGB
|
||||
await sharp(input)
|
||||
.toColourspace('rgb16')
|
||||
.toFile('16-bpp.png')
|
||||
```
|
||||
|
||||
|
||||
## toColorspace
|
||||
> toColorspace([colorspace]) ⇒ <code>Sharp</code>
|
||||
|
||||
Alternative spelling of `toColourspace`.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [colorspace] | <code>string</code> | output colorspace. |
|
103
docs/src/content/docs/api-composite.md
Normal file
103
docs/src/content/docs/api-composite.md
Normal file
@ -0,0 +1,103 @@
|
||||
---
|
||||
# This file was auto-generated from JSDoc in lib/composite.js
|
||||
title: Compositing images
|
||||
---
|
||||
|
||||
## composite
|
||||
> composite(images) ⇒ <code>Sharp</code>
|
||||
|
||||
Composite image(s) over the processed (resized, extracted etc.) image.
|
||||
|
||||
The images to composite must be the same size or smaller than the processed image.
|
||||
If both `top` and `left` options are provided, they take precedence over `gravity`.
|
||||
|
||||
Other operations in the same processing pipeline (e.g. resize, rotate, flip,
|
||||
flop, extract) will always be applied to the input image before composition.
|
||||
|
||||
The `blend` option can be one of `clear`, `source`, `over`, `in`, `out`, `atop`,
|
||||
`dest`, `dest-over`, `dest-in`, `dest-out`, `dest-atop`,
|
||||
`xor`, `add`, `saturate`, `multiply`, `screen`, `overlay`, `darken`, `lighten`,
|
||||
`colour-dodge`, `color-dodge`, `colour-burn`,`color-burn`,
|
||||
`hard-light`, `soft-light`, `difference`, `exclusion`.
|
||||
|
||||
More information about blend modes can be found at
|
||||
https://www.libvips.org/API/current/libvips-conversion.html#VipsBlendMode
|
||||
and https://www.cairographics.org/operators/
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
**Since**: 0.22.0
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| images | <code>Array.<Object></code> | | Ordered list of images to composite |
|
||||
| [images[].input] | <code>Buffer</code> \| <code>String</code> | | Buffer containing image data, String containing the path to an image file, or Create object (see below) |
|
||||
| [images[].input.create] | <code>Object</code> | | describes a blank overlay to be created. |
|
||||
| [images[].input.create.width] | <code>Number</code> | | |
|
||||
| [images[].input.create.height] | <code>Number</code> | | |
|
||||
| [images[].input.create.channels] | <code>Number</code> | | 3-4 |
|
||||
| [images[].input.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. |
|
||||
| [images[].input.text] | <code>Object</code> | | describes a new text image to be created. |
|
||||
| [images[].input.text.text] | <code>string</code> | | text to render as a UTF-8 string. It can contain Pango markup, for example `<i>Le</i>Monde`. |
|
||||
| [images[].input.text.font] | <code>string</code> | | font name to render with. |
|
||||
| [images[].input.text.fontfile] | <code>string</code> | | absolute filesystem path to a font file that can be used by `font`. |
|
||||
| [images[].input.text.width] | <code>number</code> | <code>0</code> | integral number of pixels to word-wrap at. Lines of text wider than this will be broken at word boundaries. |
|
||||
| [images[].input.text.height] | <code>number</code> | <code>0</code> | integral number of pixels high. When defined, `dpi` will be ignored and the text will automatically fit the pixel resolution defined by `width` and `height`. Will be ignored if `width` is not specified or set to 0. |
|
||||
| [images[].input.text.align] | <code>string</code> | <code>"'left'"</code> | text alignment (`'left'`, `'centre'`, `'center'`, `'right'`). |
|
||||
| [images[].input.text.justify] | <code>boolean</code> | <code>false</code> | set this to true to apply justification to the text. |
|
||||
| [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.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[].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[].left] | <code>Number</code> | | the pixel offset from the left edge. |
|
||||
| [images[].tile] | <code>Boolean</code> | <code>false</code> | set to true to repeat the overlay image across the entire image with the given `gravity`. |
|
||||
| [images[].premultiplied] | <code>Boolean</code> | <code>false</code> | set to true to avoid premultiplying the image below. Equivalent to the `--premultiplied` vips option. |
|
||||
| [images[].density] | <code>Number</code> | <code>72</code> | number representing the DPI for vector overlay image. |
|
||||
| [images[].raw] | <code>Object</code> | | describes overlay when using raw pixel data. |
|
||||
| [images[].raw.width] | <code>Number</code> | | |
|
||||
| [images[].raw.height] | <code>Number</code> | | |
|
||||
| [images[].raw.channels] | <code>Number</code> | | |
|
||||
| [images[].animated] | <code>boolean</code> | <code>false</code> | Set to `true` to read all frames/pages of an animated image. |
|
||||
| [images[].failOn] | <code>string</code> | <code>"'warning'"</code> | @see [constructor parameters](/api-constructor#parameters) |
|
||||
| [images[].limitInputPixels] | <code>number</code> \| <code>boolean</code> | <code>268402689</code> | @see [constructor parameters](/api-constructor#parameters) |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
await sharp(background)
|
||||
.composite([
|
||||
{ input: layer1, gravity: 'northwest' },
|
||||
{ input: layer2, gravity: 'southeast' },
|
||||
])
|
||||
.toFile('combined.png');
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp('input.gif', { animated: true })
|
||||
.composite([
|
||||
{ input: 'overlay.png', tile: true, blend: 'saturate' }
|
||||
])
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
sharp('input.png')
|
||||
.rotate(180)
|
||||
.resize(300)
|
||||
.flatten( { background: '#ff6600' } )
|
||||
.composite([{ input: 'overlay.png', gravity: 'southeast' }])
|
||||
.sharpen()
|
||||
.withMetadata()
|
||||
.webp( { quality: 90 } )
|
||||
.toBuffer()
|
||||
.then(function(outputBuffer) {
|
||||
// outputBuffer contains upside down, 300px wide, alpha channel flattened
|
||||
// onto orange background, composited with overlay.png with SE gravity,
|
||||
// sharpened, with metadata, 90% quality WebP image data. Phew!
|
||||
});
|
||||
```
|
274
docs/src/content/docs/api-constructor.md
Normal file
274
docs/src/content/docs/api-constructor.md
Normal file
@ -0,0 +1,274 @@
|
||||
---
|
||||
# This file was auto-generated from JSDoc in lib/constructor.js
|
||||
title: Constructor
|
||||
---
|
||||
|
||||
## Sharp
|
||||
> Sharp
|
||||
|
||||
|
||||
**Emits**: <code>Sharp#event:info</code>, <code>Sharp#event:warning</code>
|
||||
<a name="new_Sharp_new"></a>
|
||||
|
||||
### new
|
||||
> new Sharp([input], [options])
|
||||
|
||||
Constructor factory to create an instance of `sharp`, to which further methods are chained.
|
||||
|
||||
JPEG, PNG, WebP, GIF, AVIF or TIFF format image data can be streamed out from this object.
|
||||
When using Stream based output, derived attributes are available from the `info` event.
|
||||
|
||||
Non-critical problems encountered during processing are emitted as `warning` events.
|
||||
|
||||
Implements the [stream.Duplex](http://nodejs.org/api/stream.html#stream_class_stream_duplex) class.
|
||||
|
||||
When loading more than one page/frame of an animated image,
|
||||
these are combined as a vertically-stacked "toilet roll" image
|
||||
where the overall height is the `pageHeight` multiplied by the number of `pages`.
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| 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> \| <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.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.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.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.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.animated] | <code>boolean</code> | <code>false</code> | Set to `true` to read all frames/pages of an animated image (GIF, WebP, TIFF), equivalent of setting `pages` to `-1`. |
|
||||
| [options.raw] | <code>Object</code> | | describes raw pixel input image data. See `raw()` for pixel ordering. |
|
||||
| [options.raw.width] | <code>number</code> | | integral number of pixels wide. |
|
||||
| [options.raw.height] | <code>number</code> | | integral number of pixels high. |
|
||||
| [options.raw.channels] | <code>number</code> | | integral number of channels, between 1 and 4. |
|
||||
| [options.raw.premultiplied] | <code>boolean</code> | | specifies that the raw input has already been premultiplied, set to `true` to avoid sharp premultiplying the image. (optional, default `false`) |
|
||||
| [options.raw.pageHeight] | <code>number</code> | | The pixel height of each page/frame for animated images, must be an integral factor of `raw.height`. |
|
||||
| [options.create] | <code>Object</code> | | describes a new image to be created. |
|
||||
| [options.create.width] | <code>number</code> | | integral number of pixels wide. |
|
||||
| [options.create.height] | <code>number</code> | | integral number of pixels high. |
|
||||
| [options.create.channels] | <code>number</code> | | integral number of channels, either 3 (RGB) or 4 (RGBA). |
|
||||
| [options.create.background] | <code>string</code> \| <code>Object</code> | | parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
|
||||
| [options.create.pageHeight] | <code>number</code> | | The pixel height of each page/frame for animated images, must be an integral factor of `create.height`. |
|
||||
| [options.create.noise] | <code>Object</code> | | describes a noise to be created. |
|
||||
| [options.create.noise.type] | <code>string</code> | | type of generated noise, currently only `gaussian` is supported. |
|
||||
| [options.create.noise.mean] | <code>number</code> | <code>128</code> | Mean value of pixels in the generated noise. |
|
||||
| [options.create.noise.sigma] | <code>number</code> | <code>30</code> | Standard deviation of pixel values in the generated noise. |
|
||||
| [options.text] | <code>Object</code> | | describes a new text image to be created. |
|
||||
| [options.text.text] | <code>string</code> | | text to render as a UTF-8 string. It can contain Pango markup, for example `<i>Le</i>Monde`. |
|
||||
| [options.text.font] | <code>string</code> | | font name to render with. |
|
||||
| [options.text.fontfile] | <code>string</code> | | absolute filesystem path to a font file that can be used by `font`. |
|
||||
| [options.text.width] | <code>number</code> | <code>0</code> | Integral number of pixels to word-wrap at. Lines of text wider than this will be broken at word boundaries. |
|
||||
| [options.text.height] | <code>number</code> | <code>0</code> | Maximum integral number of pixels high. When defined, `dpi` will be ignored and the text will automatically fit the pixel resolution defined by `width` and `height`. Will be ignored if `width` is not specified or set to 0. |
|
||||
| [options.text.align] | <code>string</code> | <code>"'left'"</code> | Alignment style for multi-line text (`'left'`, `'centre'`, `'center'`, `'right'`). |
|
||||
| [options.text.justify] | <code>boolean</code> | <code>false</code> | set this to true to apply justification to the text. |
|
||||
| [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.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', '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**
|
||||
```js
|
||||
sharp('input.jpg')
|
||||
.resize(300, 200)
|
||||
.toFile('output.jpg', function(err) {
|
||||
// output.jpg is a 300 pixels wide and 200 pixels high image
|
||||
// containing a scaled and cropped version of input.jpg
|
||||
});
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Read image data from remote URL,
|
||||
// resize to 300 pixels wide,
|
||||
// emit an 'info' event with calculated dimensions
|
||||
// and finally write image data to writableStream
|
||||
const { body } = fetch('https://...');
|
||||
const readableStream = Readable.fromWeb(body);
|
||||
const transformer = sharp()
|
||||
.resize(300)
|
||||
.on('info', ({ height }) => {
|
||||
console.log(`Image height is ${height}`);
|
||||
});
|
||||
readableStream.pipe(transformer).pipe(writableStream);
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Create a blank 300x200 PNG image of semi-translucent red pixels
|
||||
sharp({
|
||||
create: {
|
||||
width: 300,
|
||||
height: 200,
|
||||
channels: 4,
|
||||
background: { r: 255, g: 0, b: 0, alpha: 0.5 }
|
||||
}
|
||||
})
|
||||
.png()
|
||||
.toBuffer()
|
||||
.then( ... );
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Convert an animated GIF to an animated WebP
|
||||
await sharp('in.gif', { animated: true }).toFile('out.webp');
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Read a raw array of pixels and save it to a png
|
||||
const input = Uint8Array.from([255, 255, 255, 0, 0, 0]); // or Uint8ClampedArray
|
||||
const image = sharp(input, {
|
||||
// because the input does not contain its dimensions or how many channels it has
|
||||
// we need to specify it in the constructor options
|
||||
raw: {
|
||||
width: 2,
|
||||
height: 1,
|
||||
channels: 3
|
||||
}
|
||||
});
|
||||
await image.toFile('my-two-pixels.png');
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Generate RGB Gaussian noise
|
||||
await sharp({
|
||||
create: {
|
||||
width: 300,
|
||||
height: 200,
|
||||
channels: 3,
|
||||
noise: {
|
||||
type: 'gaussian',
|
||||
mean: 128,
|
||||
sigma: 30
|
||||
}
|
||||
}
|
||||
}).toFile('noise.png');
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Generate an image from text
|
||||
await sharp({
|
||||
text: {
|
||||
text: 'Hello, world!',
|
||||
width: 400, // max width
|
||||
height: 300 // max height
|
||||
}
|
||||
}).toFile('text_bw.png');
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Generate an rgba image from text using pango markup and font
|
||||
await sharp({
|
||||
text: {
|
||||
text: '<span foreground="red">Red!</span><span background="cyan">blue</span>',
|
||||
font: 'sans',
|
||||
rgba: true,
|
||||
dpi: 300
|
||||
}
|
||||
}).toFile('text_rgba.png');
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Join four input images as a 2x2 grid with a 4 pixel gutter
|
||||
const data = await sharp(
|
||||
[image1, image2, image3, image4],
|
||||
{ join: { across: 2, shim: 4 } }
|
||||
).toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Generate a two-frame animated image from emoji
|
||||
const images = ['😀', '😛'].map(text => ({
|
||||
text: { text, width: 64, height: 64, channels: 4, rgba: true }
|
||||
}));
|
||||
await sharp(images, { join: { animated: true } }).toFile('out.gif');
|
||||
```
|
||||
|
||||
|
||||
## clone
|
||||
> clone() ⇒ [<code>Sharp</code>](#Sharp)
|
||||
|
||||
Take a "snapshot" of the Sharp instance, returning a new instance.
|
||||
Cloned instances inherit the input of their parent instance.
|
||||
This allows multiple output Streams and therefore multiple processing pipelines to share a single input Stream.
|
||||
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const pipeline = sharp().rotate();
|
||||
pipeline.clone().resize(800, 600).pipe(firstWritableStream);
|
||||
pipeline.clone().extract({ left: 20, top: 20, width: 100, height: 100 }).pipe(secondWritableStream);
|
||||
readableStream.pipe(pipeline);
|
||||
// firstWritableStream receives auto-rotated, resized readableStream
|
||||
// secondWritableStream receives auto-rotated, extracted region of readableStream
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Create a pipeline that will download an image, resize it and format it to different files
|
||||
// Using Promises to know when the pipeline is complete
|
||||
const fs = require("fs");
|
||||
const got = require("got");
|
||||
const sharpStream = sharp({ failOn: 'none' });
|
||||
|
||||
const promises = [];
|
||||
|
||||
promises.push(
|
||||
sharpStream
|
||||
.clone()
|
||||
.jpeg({ quality: 100 })
|
||||
.toFile("originalFile.jpg")
|
||||
);
|
||||
|
||||
promises.push(
|
||||
sharpStream
|
||||
.clone()
|
||||
.resize({ width: 500 })
|
||||
.jpeg({ quality: 80 })
|
||||
.toFile("optimized-500.jpg")
|
||||
);
|
||||
|
||||
promises.push(
|
||||
sharpStream
|
||||
.clone()
|
||||
.resize({ width: 500 })
|
||||
.webp({ quality: 80 })
|
||||
.toFile("optimized-500.webp")
|
||||
);
|
||||
|
||||
// https://github.com/sindresorhus/got/blob/main/documentation/3-streams.md
|
||||
got.stream("https://www.example.com/some-file.jpg").pipe(sharpStream);
|
||||
|
||||
Promise.all(promises)
|
||||
.then(res => { console.log("Done!", res); })
|
||||
.catch(err => {
|
||||
console.error("Error processing files, let's clean it up", err);
|
||||
try {
|
||||
fs.unlinkSync("originalFile.jpg");
|
||||
fs.unlinkSync("optimized-500.jpg");
|
||||
fs.unlinkSync("optimized-500.webp");
|
||||
} catch (e) {}
|
||||
});
|
||||
```
|
139
docs/src/content/docs/api-input.md
Normal file
139
docs/src/content/docs/api-input.md
Normal file
@ -0,0 +1,139 @@
|
||||
---
|
||||
# This file was auto-generated from JSDoc in lib/input.js
|
||||
title: Input metadata
|
||||
---
|
||||
|
||||
## metadata
|
||||
> metadata([callback]) ⇒ <code>Promise.<Object></code> \| <code>Sharp</code>
|
||||
|
||||
Fast access to (uncached) image metadata without decoding any compressed pixel data.
|
||||
|
||||
This is read from the header of the input image.
|
||||
It does not take into consideration any operations to be applied to the output image,
|
||||
such as resize or rotate.
|
||||
|
||||
Dimensions in the response will respect the `page` and `pages` properties of the
|
||||
[constructor parameters](/api-constructor#parameters).
|
||||
|
||||
A `Promise` is returned when `callback` is not provided.
|
||||
|
||||
- `format`: Name of decoder used to decompress image data e.g. `jpeg`, `png`, `webp`, `gif`, `svg`
|
||||
- `size`: Total size of image in bytes, for Stream and Buffer input only
|
||||
- `width`: Number of pixels wide (EXIF orientation is not taken into consideration, see example below)
|
||||
- `height`: Number of pixels high (EXIF orientation is not taken into consideration, see example below)
|
||||
- `space`: Name of colour space interpretation e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://www.libvips.org/API/current/VipsImage.html#VipsInterpretation)
|
||||
- `channels`: Number of bands e.g. `3` for sRGB, `4` for CMYK
|
||||
- `depth`: Name of pixel depth format e.g. `uchar`, `char`, `ushort`, `float` [...](https://www.libvips.org/API/current/VipsImage.html#VipsBandFormat)
|
||||
- `density`: Number of pixels per inch (DPI), if present
|
||||
- `chromaSubsampling`: String containing JPEG chroma subsampling, `4:2:0` or `4:4:4` for RGB, `4:2:0:4` or `4:4:4:4` for CMYK
|
||||
- `isProgressive`: Boolean indicating whether the image is interlaced using a progressive scan
|
||||
- `isPalette`: Boolean indicating whether the image is palette-based (GIF, PNG).
|
||||
- `bitsPerSample`: Number of bits per sample for each channel (GIF, PNG, HEIF).
|
||||
- `pages`: Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP
|
||||
- `pageHeight`: Number of pixels high each page in a multi-page image will be.
|
||||
- `loop`: Number of times to loop an animated image, zero refers to a continuous loop.
|
||||
- `delay`: Delay in ms between each page in an animated image, provided as an array of integers.
|
||||
- `pagePrimary`: Number of the primary page in a HEIF image
|
||||
- `levels`: Details of each level in a multi-level image provided as an array of objects, requires libvips compiled with support for OpenSlide
|
||||
- `subifds`: Number of Sub Image File Directories in an OME-TIFF image
|
||||
- `background`: Default background colour, if present, for PNG (bKGD) and GIF images
|
||||
- `compression`: The encoder used to compress an HEIF file, `av1` (AVIF) or `hevc` (HEIC)
|
||||
- `resolutionUnit`: The unit of resolution (density), either `inch` or `cm`, if present
|
||||
- `hasProfile`: Boolean indicating the presence of an embedded ICC profile
|
||||
- `hasAlpha`: Boolean indicating the presence of an alpha transparency channel
|
||||
- `orientation`: Number value of the EXIF Orientation header, if present
|
||||
- `exif`: Buffer containing raw EXIF data, if present
|
||||
- `icc`: Buffer containing raw [ICC](https://www.npmjs.com/package/icc) profile data, if present
|
||||
- `iptc`: Buffer containing raw IPTC data, if present
|
||||
- `xmp`: Buffer containing raw XMP data, if present
|
||||
- `xmpAsString`: String containing XMP data, if valid UTF-8.
|
||||
- `tifftagPhotoshop`: Buffer containing raw TIFFTAG_PHOTOSHOP data, if present
|
||||
- `formatMagick`: String containing format for images loaded via *magick
|
||||
- `comments`: Array of keyword/text pairs representing PNG text blocks, if present.
|
||||
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [callback] | <code>function</code> | called with the arguments `(err, metadata)` |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const metadata = await sharp(input).metadata();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const image = sharp(inputJpg);
|
||||
image
|
||||
.metadata()
|
||||
.then(function(metadata) {
|
||||
return image
|
||||
.resize(Math.round(metadata.width / 2))
|
||||
.webp()
|
||||
.toBuffer();
|
||||
})
|
||||
.then(function(data) {
|
||||
// data contains a WebP image half the width and height of the original JPEG
|
||||
});
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Get dimensions taking EXIF Orientation into account.
|
||||
const { autoOrient } = await sharp(input).metadata();
|
||||
const { width, height } = autoOrient;
|
||||
```
|
||||
|
||||
|
||||
## stats
|
||||
> stats([callback]) ⇒ <code>Promise.<Object></code>
|
||||
|
||||
Access to pixel-derived image statistics for every channel in the image.
|
||||
A `Promise` is returned when `callback` is not provided.
|
||||
|
||||
- `channels`: Array of channel statistics for each channel in the image. Each channel statistic contains
|
||||
- `min` (minimum value in the channel)
|
||||
- `max` (maximum value in the channel)
|
||||
- `sum` (sum of all values in a channel)
|
||||
- `squaresSum` (sum of squared values in a channel)
|
||||
- `mean` (mean of the values in a channel)
|
||||
- `stdev` (standard deviation for the values in a channel)
|
||||
- `minX` (x-coordinate of one of the pixel where the minimum lies)
|
||||
- `minY` (y-coordinate of one of the pixel where the minimum lies)
|
||||
- `maxX` (x-coordinate of one of the pixel where the maximum lies)
|
||||
- `maxY` (y-coordinate of one of the pixel where the maximum lies)
|
||||
- `isOpaque`: Is the image fully opaque? Will be `true` if the image has no alpha channel or if every pixel is fully opaque.
|
||||
- `entropy`: Histogram-based estimation of greyscale entropy, discarding alpha channel if any.
|
||||
- `sharpness`: Estimation of greyscale sharpness based on the standard deviation of a Laplacian convolution, discarding alpha channel if any.
|
||||
- `dominant`: Object containing most dominant sRGB colour based on a 4096-bin 3D histogram.
|
||||
|
||||
**Note**: Statistics are derived from the original input image. Any operations performed on the image must first be
|
||||
written to a buffer in order to run `stats` on the result (see third example).
|
||||
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [callback] | <code>function</code> | called with the arguments `(err, stats)` |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const image = sharp(inputJpg);
|
||||
image
|
||||
.stats()
|
||||
.then(function(stats) {
|
||||
// stats contains the channel-wise statistics array and the isOpaque value
|
||||
});
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const { entropy, sharpness, dominant } = await sharp(input).stats();
|
||||
const { r, g, b } = dominant;
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const image = sharp(input);
|
||||
// store intermediate result
|
||||
const part = await image.extract(region).toBuffer();
|
||||
// create new instance to obtain statistics of extracted region
|
||||
const stats = await sharp(part).stats();
|
||||
```
|
723
docs/src/content/docs/api-operation.md
Normal file
723
docs/src/content/docs/api-operation.md
Normal file
@ -0,0 +1,723 @@
|
||||
---
|
||||
# This file was auto-generated from JSDoc in lib/operation.js
|
||||
title: Image operations
|
||||
---
|
||||
|
||||
## rotate
|
||||
> rotate([angle], [options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Rotate the output image.
|
||||
|
||||
The provided angle is converted to a valid positive degree rotation.
|
||||
For example, `-450` will produce a 270 degree rotation.
|
||||
|
||||
When rotating by an angle other than a multiple of 90,
|
||||
the background colour can be provided with the `background` option.
|
||||
|
||||
For backwards compatibility, if no angle is provided, `.autoOrient()` will be called.
|
||||
|
||||
Only one rotation can occur per pipeline (aside from an initial call without
|
||||
arguments to orient via EXIF data). Previous calls to `rotate` in the same
|
||||
pipeline will be ignored.
|
||||
|
||||
Multi-page images can only be rotated by 180 degrees.
|
||||
|
||||
Method order is important when rotating, resizing and/or extracting regions,
|
||||
for example `.rotate(x).extract(y)` will produce a different result to `.extract(y).rotate(x)`.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [angle] | <code>number</code> | <code>auto</code> | angle of rotation. |
|
||||
| [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. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const rotateThenResize = await sharp(input)
|
||||
.rotate(90)
|
||||
.resize({ width: 16, height: 8, fit: 'fill' })
|
||||
.toBuffer();
|
||||
const resizeThenRotate = await sharp(input)
|
||||
.resize({ width: 16, height: 8, fit: 'fill' })
|
||||
.rotate(90)
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## autoOrient
|
||||
> autoOrient() ⇒ <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]) ⇒ <code>Sharp</code>
|
||||
|
||||
Mirror the image vertically (up-down) about the x-axis.
|
||||
This always occurs before rotation, if any.
|
||||
|
||||
This operation does not work correctly with multi-page images.
|
||||
|
||||
|
||||
|
||||
| Param | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| [flip] | <code>Boolean</code> | <code>true</code> |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input).flip().toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## flop
|
||||
> flop([flop]) ⇒ <code>Sharp</code>
|
||||
|
||||
Mirror the image horizontally (left-right) about the y-axis.
|
||||
This always occurs before rotation, if any.
|
||||
|
||||
|
||||
|
||||
| Param | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| [flop] | <code>Boolean</code> | <code>true</code> |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input).flop().toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## affine
|
||||
> affine(matrix, [options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
|
||||
|
||||
You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
||||
By default, new pixels are filled with a black background. You can provide a background colour with the `background` option.
|
||||
A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
||||
|
||||
In the case of a 2x2 matrix, the transform is:
|
||||
- X = `matrix[0, 0]` \* (x + `idx`) + `matrix[0, 1]` \* (y + `idy`) + `odx`
|
||||
- Y = `matrix[1, 0]` \* (x + `idx`) + `matrix[1, 1]` \* (y + `idy`) + `ody`
|
||||
|
||||
where:
|
||||
- x and y are the coordinates in input image.
|
||||
- X and Y are the coordinates in output image.
|
||||
- (0,0) is the upper left corner.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
**Since**: 0.27.0
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| matrix | <code>Array.<Array.<number>></code> \| <code>Array.<number></code> | | affine transformation matrix |
|
||||
| [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.idx] | <code>Number</code> | <code>0</code> | input horizontal offset |
|
||||
| [options.idy] | <code>Number</code> | <code>0</code> | input vertical offset |
|
||||
| [options.odx] | <code>Number</code> | <code>0</code> | output horizontal offset |
|
||||
| [options.ody] | <code>Number</code> | <code>0</code> | output vertical offset |
|
||||
| [options.interpolator] | <code>String</code> | <code>sharp.interpolators.bicubic</code> | interpolator |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const pipeline = sharp()
|
||||
.affine([[1, 0.3], [0.1, 0.7]], {
|
||||
background: 'white',
|
||||
interpolator: sharp.interpolators.nohalo
|
||||
})
|
||||
.toBuffer((err, outputBuffer, info) => {
|
||||
// outputBuffer contains the transformed image
|
||||
// info.width and info.height contain the new dimensions
|
||||
});
|
||||
|
||||
inputStream
|
||||
.pipe(pipeline);
|
||||
```
|
||||
|
||||
|
||||
## sharpen
|
||||
> sharpen([options], [flat], [jagged]) ⇒ <code>Sharp</code>
|
||||
|
||||
Sharpen the image.
|
||||
|
||||
When used without parameters, performs a fast, mild sharpen of the output image.
|
||||
|
||||
When a `sigma` is provided, performs a slower, more accurate sharpen of the L channel in the LAB colour space.
|
||||
Fine-grained control over the level of sharpening in "flat" (m1) and "jagged" (m2) areas is available.
|
||||
|
||||
See [libvips sharpen](https://www.libvips.org/API/current/libvips-convolution.html#vips-sharpen) operation.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> \| <code>number</code> | | if present, is an Object with attributes |
|
||||
| [options.sigma] | <code>number</code> | | the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`, between 0.000001 and 10 |
|
||||
| [options.m1] | <code>number</code> | <code>1.0</code> | the level of sharpening to apply to "flat" areas, between 0 and 1000000 |
|
||||
| [options.m2] | <code>number</code> | <code>2.0</code> | the level of sharpening to apply to "jagged" areas, between 0 and 1000000 |
|
||||
| [options.x1] | <code>number</code> | <code>2.0</code> | threshold between "flat" and "jagged", between 0 and 1000000 |
|
||||
| [options.y2] | <code>number</code> | <code>10.0</code> | maximum amount of brightening, between 0 and 1000000 |
|
||||
| [options.y3] | <code>number</code> | <code>20.0</code> | maximum amount of darkening, between 0 and 1000000 |
|
||||
| [flat] | <code>number</code> | | (deprecated) see `options.m1`. |
|
||||
| [jagged] | <code>number</code> | | (deprecated) see `options.m2`. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const data = await sharp(input).sharpen().toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const data = await sharp(input).sharpen({ sigma: 2 }).toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const data = await sharp(input)
|
||||
.sharpen({
|
||||
sigma: 2,
|
||||
m1: 0,
|
||||
m2: 3,
|
||||
x1: 3,
|
||||
y2: 15,
|
||||
y3: 15,
|
||||
})
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## median
|
||||
> median([size]) ⇒ <code>Sharp</code>
|
||||
|
||||
Apply median filter.
|
||||
When used without parameters the default window is 3x3.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [size] | <code>number</code> | <code>3</code> | square mask size: size x size |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input).median().toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input).median(5).toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## blur
|
||||
> blur([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Blur the image.
|
||||
|
||||
When used without parameters, performs a fast 3x3 box blur (equivalent to a box linear filter).
|
||||
|
||||
When a `sigma` is provided, performs a slower, more accurate Gaussian blur.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [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**
|
||||
```js
|
||||
const boxBlurred = await sharp(input)
|
||||
.blur()
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const gaussianBlurred = await sharp(input)
|
||||
.blur(5)
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## 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([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Merge alpha transparency channel, if any, with a background, then remove the alpha channel.
|
||||
|
||||
See also [removeAlpha](/api-channel#removealpha).
|
||||
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | |
|
||||
| [options.background] | <code>string</code> \| <code>Object</code> | <code>"{r: 0, g: 0, b: 0}"</code> | background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
await sharp(rgbaInput)
|
||||
.flatten({ background: '#F0A703' })
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## unflatten
|
||||
> unflatten()
|
||||
|
||||
Ensure the image has an alpha channel
|
||||
with all white pixel values made fully transparent.
|
||||
|
||||
Existing alpha channel values for non-white pixels remain unchanged.
|
||||
|
||||
This feature is experimental and the API may change.
|
||||
|
||||
|
||||
**Since**: 0.32.1
|
||||
**Example**
|
||||
```js
|
||||
await sharp(rgbInput)
|
||||
.unflatten()
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
await sharp(rgbInput)
|
||||
.threshold(128, { grayscale: false }) // converter bright pixels to white
|
||||
.unflatten()
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## gamma
|
||||
> gamma([gamma], [gammaOut]) ⇒ <code>Sharp</code>
|
||||
|
||||
Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of `1/gamma`
|
||||
then increasing the encoding (brighten) post-resize at a factor of `gamma`.
|
||||
This can improve the perceived brightness of a resized image in non-linear colour spaces.
|
||||
JPEG and WebP input images will not take advantage of the shrink-on-load performance optimisation
|
||||
when applying a gamma correction.
|
||||
|
||||
Supply a second argument to use a different output gamma value, otherwise the first value is used in both cases.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [gamma] | <code>number</code> | <code>2.2</code> | value between 1.0 and 3.0. |
|
||||
| [gammaOut] | <code>number</code> | | value between 1.0 and 3.0. (optional, defaults to same as `gamma`) |
|
||||
|
||||
|
||||
|
||||
## negate
|
||||
> negate([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Produce the "negative" of the image.
|
||||
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | |
|
||||
| [options.alpha] | <code>Boolean</code> | <code>true</code> | Whether or not to negate any alpha channel |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input)
|
||||
.negate()
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input)
|
||||
.negate({ alpha: false })
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## normalise
|
||||
> normalise([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Enhance output image contrast by stretching its luminance to cover a full dynamic range.
|
||||
|
||||
Uses a histogram-based approach, taking a default range of 1% to 99% to reduce sensitivity to noise at the extremes.
|
||||
|
||||
Luminance values below the `lower` percentile will be underexposed by clipping to zero.
|
||||
Luminance values above the `upper` percentile will be overexposed by clipping to the max pixel value.
|
||||
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | |
|
||||
| [options.lower] | <code>number</code> | <code>1</code> | Percentile below which luminance values will be underexposed. |
|
||||
| [options.upper] | <code>number</code> | <code>99</code> | Percentile above which luminance values will be overexposed. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input)
|
||||
.normalise()
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input)
|
||||
.normalise({ lower: 0, upper: 100 })
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## normalize
|
||||
> normalize([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Alternative spelling of normalise.
|
||||
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | |
|
||||
| [options.lower] | <code>number</code> | <code>1</code> | Percentile below which luminance values will be underexposed. |
|
||||
| [options.upper] | <code>number</code> | <code>99</code> | Percentile above which luminance values will be overexposed. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input)
|
||||
.normalize()
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## clahe
|
||||
> clahe(options) ⇒ <code>Sharp</code>
|
||||
|
||||
Perform contrast limiting adaptive histogram equalization
|
||||
[CLAHE](https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE).
|
||||
|
||||
This will, in general, enhance the clarity of the image by bringing out darker details.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
**Since**: 0.28.3
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| options | <code>Object</code> | | |
|
||||
| options.width | <code>number</code> | | Integral width of the search window, in pixels. |
|
||||
| options.height | <code>number</code> | | Integral height of the search window, in pixels. |
|
||||
| [options.maxSlope] | <code>number</code> | <code>3</code> | Integral level of brightening, between 0 and 100, where 0 disables contrast limiting. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input)
|
||||
.clahe({
|
||||
width: 3,
|
||||
height: 3,
|
||||
})
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## convolve
|
||||
> convolve(kernel) ⇒ <code>Sharp</code>
|
||||
|
||||
Convolve the image with the specified kernel.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| kernel | <code>Object</code> | | |
|
||||
| kernel.width | <code>number</code> | | width of the kernel in pixels. |
|
||||
| kernel.height | <code>number</code> | | height of the kernel in pixels. |
|
||||
| kernel.kernel | <code>Array.<number></code> | | Array of length `width*height` containing the kernel values. |
|
||||
| [kernel.scale] | <code>number</code> | <code>sum</code> | the scale of the kernel in pixels. |
|
||||
| [kernel.offset] | <code>number</code> | <code>0</code> | the offset of the kernel in pixels. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.convolve({
|
||||
width: 3,
|
||||
height: 3,
|
||||
kernel: [-1, 0, 1, -2, 0, 2, -1, 0, 1]
|
||||
})
|
||||
.raw()
|
||||
.toBuffer(function(err, data, info) {
|
||||
// data contains the raw pixel data representing the convolution
|
||||
// of the input image with the horizontal Sobel operator
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## threshold
|
||||
> threshold([threshold], [options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Any pixel value greater than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [threshold] | <code>number</code> | <code>128</code> | a value in the range 0-255 representing the level at which the threshold will be applied. |
|
||||
| [options] | <code>Object</code> | | |
|
||||
| [options.greyscale] | <code>Boolean</code> | <code>true</code> | convert to single channel greyscale. |
|
||||
| [options.grayscale] | <code>Boolean</code> | <code>true</code> | alternative spelling for greyscale. |
|
||||
|
||||
|
||||
|
||||
## boolean
|
||||
> boolean(operand, operator, [options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Perform a bitwise boolean operation with operand image.
|
||||
|
||||
This operation creates an output image where each pixel is the result of
|
||||
the selected bitwise boolean `operation` between the corresponding pixels of the input images.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| operand | <code>Buffer</code> \| <code>string</code> | Buffer containing image data or string containing the path to an image file. |
|
||||
| operator | <code>string</code> | one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively. |
|
||||
| [options] | <code>Object</code> | |
|
||||
| [options.raw] | <code>Object</code> | describes operand when using raw pixel data. |
|
||||
| [options.raw.width] | <code>number</code> | |
|
||||
| [options.raw.height] | <code>number</code> | |
|
||||
| [options.raw.channels] | <code>number</code> | |
|
||||
|
||||
|
||||
|
||||
## linear
|
||||
> linear([a], [b]) ⇒ <code>Sharp</code>
|
||||
|
||||
Apply the linear formula `a` * input + `b` to the image to adjust image levels.
|
||||
|
||||
When a single number is provided, it will be used for all image channels.
|
||||
When an array of numbers is provided, the array length must match the number of channels.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [a] | <code>number</code> \| <code>Array.<number></code> | <code>[]</code> | multiplier |
|
||||
| [b] | <code>number</code> \| <code>Array.<number></code> | <code>[]</code> | offset |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
await sharp(input)
|
||||
.linear(0.5, 2)
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
await sharp(rgbInput)
|
||||
.linear(
|
||||
[0.25, 0.5, 0.75],
|
||||
[150, 100, 50]
|
||||
)
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## recomb
|
||||
> recomb(inputMatrix) ⇒ <code>Sharp</code>
|
||||
|
||||
Recombine the image with the specified matrix.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
**Since**: 0.21.1
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| inputMatrix | <code>Array.<Array.<number>></code> | 3x3 or 4x4 Recombination matrix |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.recomb([
|
||||
[0.3588, 0.7044, 0.1368],
|
||||
[0.2990, 0.5870, 0.1140],
|
||||
[0.2392, 0.4696, 0.0912],
|
||||
])
|
||||
.raw()
|
||||
.toBuffer(function(err, data, info) {
|
||||
// data contains the raw pixel data after applying the matrix
|
||||
// With this example input, a sepia filter has been applied
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## modulate
|
||||
> modulate([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Transforms the image using brightness, saturation, hue rotation, and lightness.
|
||||
Brightness and lightness both operate on luminance, with the difference being that
|
||||
brightness is multiplicative whereas lightness is additive.
|
||||
|
||||
|
||||
**Since**: 0.22.1
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [options] | <code>Object</code> | |
|
||||
| [options.brightness] | <code>number</code> | Brightness multiplier |
|
||||
| [options.saturation] | <code>number</code> | Saturation multiplier |
|
||||
| [options.hue] | <code>number</code> | Degrees for hue rotation |
|
||||
| [options.lightness] | <code>number</code> | Lightness addend |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// increase brightness by a factor of 2
|
||||
const output = await sharp(input)
|
||||
.modulate({
|
||||
brightness: 2
|
||||
})
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// hue-rotate by 180 degrees
|
||||
const output = await sharp(input)
|
||||
.modulate({
|
||||
hue: 180
|
||||
})
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// increase lightness by +50
|
||||
const output = await sharp(input)
|
||||
.modulate({
|
||||
lightness: 50
|
||||
})
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// decrease brightness and saturation while also hue-rotating by 90 degrees
|
||||
const output = await sharp(input)
|
||||
.modulate({
|
||||
brightness: 0.5,
|
||||
saturation: 0.5,
|
||||
hue: 90,
|
||||
})
|
||||
.toBuffer();
|
||||
```
|
902
docs/src/content/docs/api-output.md
Normal file
902
docs/src/content/docs/api-output.md
Normal file
@ -0,0 +1,902 @@
|
||||
---
|
||||
# This file was auto-generated from JSDoc in lib/output.js
|
||||
title: Output options
|
||||
---
|
||||
|
||||
## toFile
|
||||
> toFile(fileOut, [callback]) ⇒ <code>Promise.<Object></code>
|
||||
|
||||
Write output image data to a file.
|
||||
|
||||
If an explicit output format is not selected, it will be inferred from the extension,
|
||||
with JPEG, PNG, WebP, AVIF, TIFF, GIF, DZI, and libvips' V format supported.
|
||||
Note that raw pixel data is only supported for buffer output.
|
||||
|
||||
By default all metadata will be removed, which includes EXIF-based orientation.
|
||||
See [withMetadata](#withmetadata) for control over this.
|
||||
|
||||
The caller is responsible for ensuring directory structures and permissions exist.
|
||||
|
||||
A `Promise` is returned when `callback` is not provided.
|
||||
|
||||
|
||||
**Returns**: <code>Promise.<Object></code> - - when no callback is provided
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| 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. Animated output will also contain `pageHeight` and `pages`. May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.toFile('output.png', (err, info) => { ... });
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.toFile('output.png')
|
||||
.then(info => { ... })
|
||||
.catch(err => { ... });
|
||||
```
|
||||
|
||||
|
||||
## toBuffer
|
||||
> toBuffer([options], [callback]) ⇒ <code>Promise.<Buffer></code>
|
||||
|
||||
Write output to a Buffer.
|
||||
JPEG, PNG, WebP, AVIF, TIFF, GIF and raw pixel data output are supported.
|
||||
|
||||
Use [toFormat](#toformat) or one of the format-specific functions such as [jpeg](#jpeg), [png](#png) etc. to set the output format.
|
||||
|
||||
If no explicit format is set, the output format will match the input image, except SVG input which becomes PNG output.
|
||||
|
||||
By default all metadata will be removed, which includes EXIF-based orientation.
|
||||
See [withMetadata](#withmetadata) for control over this.
|
||||
|
||||
`callback`, if present, gets three arguments `(err, data, info)` where:
|
||||
- `err` is an error, if any.
|
||||
- `data` is the output image data.
|
||||
- `info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
||||
`channels` and `premultiplied` (indicating if premultiplication was used).
|
||||
When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
|
||||
Animated output will also contain `pageHeight` and `pages`.
|
||||
May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
|
||||
|
||||
A `Promise` is returned when `callback` is not provided.
|
||||
|
||||
|
||||
**Returns**: <code>Promise.<Buffer></code> - - when no callback is provided
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [options] | <code>Object</code> | |
|
||||
| [options.resolveWithObject] | <code>boolean</code> | Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`. |
|
||||
| [callback] | <code>function</code> | |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.toBuffer((err, data, info) => { ... });
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.toBuffer()
|
||||
.then(data => { ... })
|
||||
.catch(err => { ... });
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.png()
|
||||
.toBuffer({ resolveWithObject: true })
|
||||
.then(({ data, info }) => { ... })
|
||||
.catch(err => { ... });
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const { data, info } = await sharp('my-image.jpg')
|
||||
// output the raw pixels
|
||||
.raw()
|
||||
.toBuffer({ resolveWithObject: true });
|
||||
|
||||
// create a more type safe way to work with the raw pixel data
|
||||
// this will not copy the data, instead it will change `data`s underlying ArrayBuffer
|
||||
// so `data` and `pixelArray` point to the same memory location
|
||||
const pixelArray = new Uint8ClampedArray(data.buffer);
|
||||
|
||||
// When you are done changing the pixelArray, sharp takes the `pixelArray` as an input
|
||||
const { width, height, channels } = info;
|
||||
await sharp(pixelArray, { raw: { width, height, channels } })
|
||||
.toFile('my-changed-image.jpg');
|
||||
```
|
||||
|
||||
|
||||
## keepExif
|
||||
> keepExif() ⇒ <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([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Keep most metadata (EXIF, XMP, IPTC) from the input image in the output image.
|
||||
|
||||
This will also convert to and add a web-friendly sRGB ICC profile if appropriate.
|
||||
|
||||
Allows orientation and density to be set or updated.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [options] | <code>Object</code> | |
|
||||
| [options.orientation] | <code>number</code> | Used to update the EXIF `Orientation` tag, integer between 1 and 8. |
|
||||
| [options.density] | <code>number</code> | Number of pixels per inch (DPI). |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const outputSrgbWithMetadata = await sharp(inputRgbWithMetadata)
|
||||
.withMetadata()
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Set output metadata to 96 DPI
|
||||
const data = await sharp(input)
|
||||
.withMetadata({ density: 96 })
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## toFormat
|
||||
> toFormat(format, options) ⇒ <code>Sharp</code>
|
||||
|
||||
Force output to a given format.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> unsupported format or options
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| format | <code>string</code> \| <code>Object</code> | as a string or an Object with an 'id' attribute |
|
||||
| options | <code>Object</code> | output options |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// Convert any input to PNG output
|
||||
const data = await sharp(input)
|
||||
.toFormat('png')
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## jpeg
|
||||
> jpeg([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Use these JPEG options for output image.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid options
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | output options |
|
||||
| [options.quality] | <code>number</code> | <code>80</code> | quality, integer 1-100 |
|
||||
| [options.progressive] | <code>boolean</code> | <code>false</code> | use progressive (interlace) scan |
|
||||
| [options.chromaSubsampling] | <code>string</code> | <code>"'4:2:0'"</code> | set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling |
|
||||
| [options.optimiseCoding] | <code>boolean</code> | <code>true</code> | optimise Huffman coding tables |
|
||||
| [options.optimizeCoding] | <code>boolean</code> | <code>true</code> | alternative spelling of optimiseCoding |
|
||||
| [options.mozjpeg] | <code>boolean</code> | <code>false</code> | use mozjpeg defaults, equivalent to `{ trellisQuantisation: true, overshootDeringing: true, optimiseScans: true, quantisationTable: 3 }` |
|
||||
| [options.trellisQuantisation] | <code>boolean</code> | <code>false</code> | apply trellis quantisation |
|
||||
| [options.overshootDeringing] | <code>boolean</code> | <code>false</code> | apply overshoot deringing |
|
||||
| [options.optimiseScans] | <code>boolean</code> | <code>false</code> | optimise progressive scans, forces progressive |
|
||||
| [options.optimizeScans] | <code>boolean</code> | <code>false</code> | alternative spelling of optimiseScans |
|
||||
| [options.quantisationTable] | <code>number</code> | <code>0</code> | quantization table to use, integer 0-8 |
|
||||
| [options.quantizationTable] | <code>number</code> | <code>0</code> | alternative spelling of quantisationTable |
|
||||
| [options.force] | <code>boolean</code> | <code>true</code> | force JPEG output, otherwise attempt to use input format |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// Convert any input to very high quality JPEG output
|
||||
const data = await sharp(input)
|
||||
.jpeg({
|
||||
quality: 100,
|
||||
chromaSubsampling: '4:4:4'
|
||||
})
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Use mozjpeg to reduce output JPEG file size (slower)
|
||||
const data = await sharp(input)
|
||||
.jpeg({ mozjpeg: true })
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## png
|
||||
> png([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Use these PNG options for output image.
|
||||
|
||||
By default, PNG output is full colour at 8 bits per pixel.
|
||||
|
||||
Indexed PNG input at 1, 2 or 4 bits per pixel is converted to 8 bits per pixel.
|
||||
Set `palette` to `true` for slower, indexed PNG output.
|
||||
|
||||
For 16 bits per pixel output, convert to `rgb16` via
|
||||
[toColourspace](/api-colour#tocolourspace).
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid options
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | |
|
||||
| [options.progressive] | <code>boolean</code> | <code>false</code> | use progressive (interlace) scan |
|
||||
| [options.compressionLevel] | <code>number</code> | <code>6</code> | zlib compression level, 0 (fastest, largest) to 9 (slowest, smallest) |
|
||||
| [options.adaptiveFiltering] | <code>boolean</code> | <code>false</code> | use adaptive row filtering |
|
||||
| [options.palette] | <code>boolean</code> | <code>false</code> | quantise to a palette-based image with alpha transparency support |
|
||||
| [options.quality] | <code>number</code> | <code>100</code> | use the lowest number of colours needed to achieve given quality, sets `palette` to `true` |
|
||||
| [options.effort] | <code>number</code> | <code>7</code> | CPU effort, between 1 (fastest) and 10 (slowest), sets `palette` to `true` |
|
||||
| [options.colours] | <code>number</code> | <code>256</code> | maximum number of palette entries, sets `palette` to `true` |
|
||||
| [options.colors] | <code>number</code> | <code>256</code> | alternative spelling of `options.colours`, sets `palette` to `true` |
|
||||
| [options.dither] | <code>number</code> | <code>1.0</code> | level of Floyd-Steinberg error diffusion, sets `palette` to `true` |
|
||||
| [options.force] | <code>boolean</code> | <code>true</code> | force PNG output, otherwise attempt to use input format |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// Convert any input to full colour PNG output
|
||||
const data = await sharp(input)
|
||||
.png()
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Convert any input to indexed PNG output (slower)
|
||||
const data = await sharp(input)
|
||||
.png({ palette: true })
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Output 16 bits per pixel RGB(A)
|
||||
const data = await sharp(input)
|
||||
.toColourspace('rgb16')
|
||||
.png()
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## webp
|
||||
> webp([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Use these WebP options for output image.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid options
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | output options |
|
||||
| [options.quality] | <code>number</code> | <code>80</code> | quality, integer 1-100 |
|
||||
| [options.alphaQuality] | <code>number</code> | <code>100</code> | quality of alpha layer, integer 0-100 |
|
||||
| [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.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.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.delay] | <code>number</code> \| <code>Array.<number></code> | | delay(s) between animation frames (in milliseconds) |
|
||||
| [options.minSize] | <code>boolean</code> | <code>false</code> | prevent use of animation key frames to minimise file size (slow) |
|
||||
| [options.mixed] | <code>boolean</code> | <code>false</code> | allow mixture of lossy and lossless animation frames (slow) |
|
||||
| [options.force] | <code>boolean</code> | <code>true</code> | force WebP output, otherwise attempt to use input format |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// Convert any input to lossless WebP output
|
||||
const data = await sharp(input)
|
||||
.webp({ lossless: true })
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Optimise the file size of an animated WebP
|
||||
const outputWebp = await sharp(inputWebp, { animated: true })
|
||||
.webp({ effort: 6 })
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## gif
|
||||
> gif([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Use these GIF options for the output image.
|
||||
|
||||
The first entry in the palette is reserved for transparency.
|
||||
|
||||
The palette of the input image will be re-used if possible.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid options
|
||||
|
||||
**Since**: 0.30.0
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | output options |
|
||||
| [options.reuse] | <code>boolean</code> | <code>true</code> | re-use existing palette, otherwise generate new (slow) |
|
||||
| [options.progressive] | <code>boolean</code> | <code>false</code> | use progressive (interlace) scan |
|
||||
| [options.colours] | <code>number</code> | <code>256</code> | maximum number of palette entries, including transparency, between 2 and 256 |
|
||||
| [options.colors] | <code>number</code> | <code>256</code> | alternative spelling of `options.colours` |
|
||||
| [options.effort] | <code>number</code> | <code>7</code> | CPU effort, between 1 (fastest) and 10 (slowest) |
|
||||
| [options.dither] | <code>number</code> | <code>1.0</code> | level of Floyd-Steinberg error diffusion, between 0 (least) and 1 (most) |
|
||||
| [options.interFrameMaxError] | <code>number</code> | <code>0</code> | maximum inter-frame error for transparency, between 0 (lossless) and 32 |
|
||||
| [options.interPaletteMaxError] | <code>number</code> | <code>3</code> | maximum inter-palette error for palette reuse, between 0 and 256 |
|
||||
| [options.keepDuplicateFrames] | <code>boolean</code> | <code>false</code> | keep duplicate frames in the output instead of combining them |
|
||||
| [options.loop] | <code>number</code> | <code>0</code> | number of animation iterations, use 0 for infinite animation |
|
||||
| [options.delay] | <code>number</code> \| <code>Array.<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 |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// Convert PNG to GIF
|
||||
await sharp(pngBuffer)
|
||||
.gif()
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Convert animated WebP to animated GIF
|
||||
await sharp('animated.webp', { animated: true })
|
||||
.toFile('animated.gif');
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Create a 128x128, cropped, non-dithered, animated thumbnail of an animated GIF
|
||||
const out = await sharp('in.gif', { animated: true })
|
||||
.resize({ width: 128, height: 128 })
|
||||
.gif({ dither: 0 })
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Lossy file size reduction of animated GIF
|
||||
await sharp('in.gif', { animated: true })
|
||||
.gif({ interFrameMaxError: 8 })
|
||||
.toFile('optim.gif');
|
||||
```
|
||||
|
||||
|
||||
## jp2
|
||||
> jp2([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Use these JP2 options for output image.
|
||||
|
||||
Requires libvips compiled with support for OpenJPEG.
|
||||
The prebuilt binaries do not include this - see
|
||||
[installing a custom libvips](https://sharp.pixelplumbing.com/install#custom-libvips).
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid options
|
||||
|
||||
**Since**: 0.29.1
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | output options |
|
||||
| [options.quality] | <code>number</code> | <code>80</code> | quality, integer 1-100 |
|
||||
| [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression mode |
|
||||
| [options.tileWidth] | <code>number</code> | <code>512</code> | horizontal tile size |
|
||||
| [options.tileHeight] | <code>number</code> | <code>512</code> | vertical tile size |
|
||||
| [options.chromaSubsampling] | <code>string</code> | <code>"'4:4:4'"</code> | set to '4:2:0' to use chroma subsampling |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// Convert any input to lossless JP2 output
|
||||
const data = await sharp(input)
|
||||
.jp2({ lossless: true })
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Convert any input to very high quality JP2 output
|
||||
const data = await sharp(input)
|
||||
.jp2({
|
||||
quality: 100,
|
||||
chromaSubsampling: '4:4:4'
|
||||
})
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## tiff
|
||||
> tiff([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Use these TIFF options for output image.
|
||||
|
||||
The `density` can be set in pixels/inch via [withMetadata](#withmetadata)
|
||||
instead of providing `xres` and `yres` in pixels/mm.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid options
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | output options |
|
||||
| [options.quality] | <code>number</code> | <code>80</code> | quality, integer 1-100 |
|
||||
| [options.force] | <code>boolean</code> | <code>true</code> | force TIFF output, otherwise attempt to use input format |
|
||||
| [options.compression] | <code>string</code> | <code>"'jpeg'"</code> | compression options: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k |
|
||||
| [options.predictor] | <code>string</code> | <code>"'horizontal'"</code> | compression predictor options: none, horizontal, float |
|
||||
| [options.pyramid] | <code>boolean</code> | <code>false</code> | write an image pyramid |
|
||||
| [options.tile] | <code>boolean</code> | <code>false</code> | write a tiled tiff |
|
||||
| [options.tileWidth] | <code>number</code> | <code>256</code> | horizontal tile size |
|
||||
| [options.tileHeight] | <code>number</code> | <code>256</code> | vertical tile size |
|
||||
| [options.xres] | <code>number</code> | <code>1.0</code> | horizontal resolution in pixels/mm |
|
||||
| [options.yres] | <code>number</code> | <code>1.0</code> | vertical resolution in pixels/mm |
|
||||
| [options.resolutionUnit] | <code>string</code> | <code>"'inch'"</code> | resolution unit options: inch, cm |
|
||||
| [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**
|
||||
```js
|
||||
// Convert SVG input to LZW-compressed, 1 bit per pixel TIFF output
|
||||
sharp('input.svg')
|
||||
.tiff({
|
||||
compression: 'lzw',
|
||||
bitdepth: 1
|
||||
})
|
||||
.toFile('1-bpp-output.tiff')
|
||||
.then(info => { ... });
|
||||
```
|
||||
|
||||
|
||||
## avif
|
||||
> avif([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Use these AVIF options for output image.
|
||||
|
||||
AVIF image sequences are not supported.
|
||||
Prebuilt binaries support a bitdepth of 8 only.
|
||||
|
||||
This feature is experimental on the Windows ARM64 platform
|
||||
and requires a CPU with ARM64v8.4 or later.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid options
|
||||
|
||||
**Since**: 0.27.0
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | output options |
|
||||
| [options.quality] | <code>number</code> | <code>50</code> | quality, integer 1-100 |
|
||||
| [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.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**
|
||||
```js
|
||||
const data = await sharp(input)
|
||||
.avif({ effort: 2 })
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const data = await sharp(input)
|
||||
.avif({ lossless: true })
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## heif
|
||||
> heif(options) ⇒ <code>Sharp</code>
|
||||
|
||||
Use these HEIF options for output image.
|
||||
|
||||
Support for patent-encumbered HEIC images using `hevc` compression requires the use of a
|
||||
globally-installed libvips compiled with support for libheif, libde265 and x265.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid options
|
||||
|
||||
**Since**: 0.23.0
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| options | <code>Object</code> | | output options |
|
||||
| options.compression | <code>string</code> | | compression format: av1, hevc |
|
||||
| [options.quality] | <code>number</code> | <code>50</code> | quality, integer 1-100 |
|
||||
| [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.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**
|
||||
```js
|
||||
const data = await sharp(input)
|
||||
.heif({ compression: 'hevc' })
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## jxl
|
||||
> jxl([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Use these JPEG-XL (JXL) options for output image.
|
||||
|
||||
This feature is experimental, please do not use in production systems.
|
||||
|
||||
Requires libvips compiled with support for libjxl.
|
||||
The prebuilt binaries do not include this - see
|
||||
[installing a custom libvips](https://sharp.pixelplumbing.com/install#custom-libvips).
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid options
|
||||
|
||||
**Since**: 0.31.3
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | output options |
|
||||
| [options.distance] | <code>number</code> | <code>1.0</code> | maximum encoding error, between 0 (highest quality) and 15 (lowest quality) |
|
||||
| [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.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression |
|
||||
| [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) |
|
||||
|
||||
|
||||
|
||||
## raw
|
||||
> raw([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Force output to be raw, uncompressed pixel data.
|
||||
Pixel ordering is left-to-right, top-to-bottom, without padding.
|
||||
Channel ordering will be RGB or RGBA for non-greyscale colourspaces.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid options
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | output options |
|
||||
| [options.depth] | <code>string</code> | <code>"'uchar'"</code> | bit depth, one of: char, uchar (default), short, ushort, int, uint, float, complex, double, dpcomplex |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// Extract raw, unsigned 8-bit RGB pixel data from JPEG input
|
||||
const { data, info } = await sharp('input.jpg')
|
||||
.raw()
|
||||
.toBuffer({ resolveWithObject: true });
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Extract alpha channel as raw, unsigned 16-bit pixel data from PNG input
|
||||
const data = await sharp('input.png')
|
||||
.ensureAlpha()
|
||||
.extractChannel(3)
|
||||
.toColourspace('b-w')
|
||||
.raw({ depth: 'ushort' })
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## tile
|
||||
> tile([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Use tile-based deep zoom (image pyramid) output.
|
||||
|
||||
Set the format and options for tile images via the `toFormat`, `jpeg`, `png` or `webp` functions.
|
||||
Use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
|
||||
|
||||
The container will be set to `zip` when the output is a Buffer or Stream, otherwise it will default to `fs`.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | |
|
||||
| [options.size] | <code>number</code> | <code>256</code> | tile size in pixels, a value between 1 and 8192. |
|
||||
| [options.overlap] | <code>number</code> | <code>0</code> | tile overlap in pixels, a value between 0 and 8192. |
|
||||
| [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.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. 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.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.center] | <code>boolean</code> | <code>false</code> | alternative spelling of centre. |
|
||||
| [options.id] | <code>string</code> | <code>"'https://example.com/iiif'"</code> | when `layout` is `iiif`/`iiif3`, sets the `@id`/`id` attribute of `info.json` |
|
||||
| [options.basename] | <code>string</code> | | the name of the directory within the zip file when container is `zip`. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
sharp('input.tiff')
|
||||
.png()
|
||||
.tile({
|
||||
size: 512
|
||||
})
|
||||
.toFile('output.dz', function(err, info) {
|
||||
// output.dzi is the Deep Zoom XML definition
|
||||
// output_files contains 512x512 tiles grouped by zoom level
|
||||
});
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const zipFileWithTiles = await sharp(input)
|
||||
.tile({ basename: "tiles" })
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const iiififier = sharp().tile({ layout: "iiif" });
|
||||
readableStream
|
||||
.pipe(iiififier)
|
||||
.pipe(writeableStream);
|
||||
```
|
||||
|
||||
|
||||
## timeout
|
||||
> timeout(options) ⇒ <code>Sharp</code>
|
||||
|
||||
Set a timeout for processing, in seconds.
|
||||
Use a value of zero to continue processing indefinitely, the default behaviour.
|
||||
|
||||
The clock starts when libvips opens an input image for processing.
|
||||
Time spent waiting for a libuv thread to become available is not included.
|
||||
|
||||
|
||||
**Since**: 0.29.2
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| options | <code>Object</code> | |
|
||||
| options.seconds | <code>number</code> | Number of seconds after which processing will be stopped |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// Ensure processing takes no longer than 3 seconds
|
||||
try {
|
||||
const data = await sharp(input)
|
||||
.blur(1000)
|
||||
.timeout({ seconds: 3 })
|
||||
.toBuffer();
|
||||
} catch (err) {
|
||||
if (err.message.includes('timeout')) { ... }
|
||||
}
|
||||
```
|
323
docs/src/content/docs/api-resize.md
Normal file
323
docs/src/content/docs/api-resize.md
Normal file
@ -0,0 +1,323 @@
|
||||
---
|
||||
# This file was auto-generated from JSDoc in lib/resize.js
|
||||
title: Resizing images
|
||||
---
|
||||
|
||||
## resize
|
||||
> resize([width], [height], [options]) ⇒ <code>Sharp</code>
|
||||
|
||||
Resize image to `width`, `height` or `width x height`.
|
||||
|
||||
When both a `width` and `height` are provided, the possible methods by which the image should **fit** these are:
|
||||
- `cover`: (default) Preserving aspect ratio, attempt to ensure the image covers both provided dimensions by cropping/clipping to fit.
|
||||
- `contain`: Preserving aspect ratio, contain within both provided dimensions using "letterboxing" where necessary.
|
||||
- `fill`: Ignore the aspect ratio of the input and stretch to both provided dimensions.
|
||||
- `inside`: Preserving aspect ratio, resize the image to be as large as possible while ensuring its dimensions are less than or equal to both those specified.
|
||||
- `outside`: Preserving aspect ratio, resize the image to be as small as possible while ensuring its dimensions are greater than or equal to both those specified.
|
||||
|
||||
Some of these values are based on the [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property.
|
||||
|
||||
<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:
|
||||
- `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`.
|
||||
- `sharp.gravity`: `north`, `northeast`, `east`, `southeast`, `south`, `southwest`, `west`, `northwest`, `center` or `centre`.
|
||||
- `sharp.strategy`: `cover` only, dynamically crop using either the `entropy` or `attention` strategy.
|
||||
|
||||
Some of these values are based on the [object-position](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position) CSS property.
|
||||
|
||||
The strategy-based approach initially resizes so one dimension is at its target length
|
||||
then repeatedly ranks edge regions, discarding the edge with the lowest score based on the selected strategy.
|
||||
- `entropy`: focus on the region with the highest [Shannon entropy](https://en.wikipedia.org/wiki/Entropy_%28information_theory%29).
|
||||
- `attention`: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.
|
||||
|
||||
Possible downsizing kernels are:
|
||||
- `nearest`: Use [nearest neighbour interpolation](http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation).
|
||||
- `linear`: Use a [triangle filter](https://en.wikipedia.org/wiki/Triangular_function).
|
||||
- `cubic`: Use a [Catmull-Rom spline](https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline).
|
||||
- `mitchell`: Use a [Mitchell-Netravali spline](https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf).
|
||||
- `lanczos2`: Use a [Lanczos kernel](https://en.wikipedia.org/wiki/Lanczos_resampling#Lanczos_kernel) with `a=2`.
|
||||
- `lanczos3`: Use a Lanczos kernel with `a=3` (the default).
|
||||
- `mks2013`: Use a [Magic Kernel Sharp](https://johncostella.com/magic/mks.pdf) 2013 kernel, as adopted by Facebook.
|
||||
- `mks2021`: Use a Magic Kernel Sharp 2021 kernel, with more accurate (reduced) sharpening than the 2013 version.
|
||||
|
||||
When upsampling, these kernels map to `nearest`, `linear` and `cubic` interpolators.
|
||||
Downsampling kernels without a matching upsampling interpolator map to `cubic`.
|
||||
|
||||
Only one resize can occur per pipeline.
|
||||
Previous calls to `resize` in the same pipeline will be ignored.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [width] | <code>number</code> | | How many pixels wide the resultant image should be. Use `null` or `undefined` to auto-scale the width to match the height. |
|
||||
| [height] | <code>number</code> | | How many pixels high the resultant image should be. Use `null` or `undefined` to auto-scale the height to match the width. |
|
||||
| [options] | <code>Object</code> | | |
|
||||
| [options.width] | <code>number</code> | | An alternative means of specifying `width`. If both are present this takes priority. |
|
||||
| [options.height] | <code>number</code> | | An alternative means of specifying `height`. If both are present this takes priority. |
|
||||
| [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.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 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.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. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.resize({ width: 100 })
|
||||
.toBuffer()
|
||||
.then(data => {
|
||||
// 100 pixels wide, auto-scaled height
|
||||
});
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.resize({ height: 100 })
|
||||
.toBuffer()
|
||||
.then(data => {
|
||||
// 100 pixels high, auto-scaled width
|
||||
});
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.resize(200, 300, {
|
||||
kernel: sharp.kernel.nearest,
|
||||
fit: 'contain',
|
||||
position: 'right top',
|
||||
background: { r: 255, g: 255, b: 255, alpha: 0.5 }
|
||||
})
|
||||
.toFile('output.png')
|
||||
.then(() => {
|
||||
// output.png is a 200 pixels wide and 300 pixels high image
|
||||
// containing a nearest-neighbour scaled version
|
||||
// contained within the north-east corner of a semi-transparent white canvas
|
||||
});
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const transformer = sharp()
|
||||
.resize({
|
||||
width: 200,
|
||||
height: 200,
|
||||
fit: sharp.fit.cover,
|
||||
position: sharp.strategy.entropy
|
||||
});
|
||||
// Read image data from readableStream
|
||||
// Write 200px square auto-cropped image data to writableStream
|
||||
readableStream
|
||||
.pipe(transformer)
|
||||
.pipe(writableStream);
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.resize(200, 200, {
|
||||
fit: sharp.fit.inside,
|
||||
withoutEnlargement: true
|
||||
})
|
||||
.toFormat('jpeg')
|
||||
.toBuffer()
|
||||
.then(function(outputBuffer) {
|
||||
// outputBuffer contains JPEG image data
|
||||
// no wider and no higher than 200 pixels
|
||||
// and no larger than the input image
|
||||
});
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.resize(200, 200, {
|
||||
fit: sharp.fit.outside,
|
||||
withoutReduction: true
|
||||
})
|
||||
.toFormat('jpeg')
|
||||
.toBuffer()
|
||||
.then(function(outputBuffer) {
|
||||
// outputBuffer contains JPEG image data
|
||||
// of at least 200 pixels wide and 200 pixels high while maintaining aspect ratio
|
||||
// and no smaller than the input image
|
||||
});
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const scaleByHalf = await sharp(input)
|
||||
.metadata()
|
||||
.then(({ width }) => sharp(input)
|
||||
.resize(Math.round(width * 0.5))
|
||||
.toBuffer()
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
## extend
|
||||
> extend(extend) ⇒ <code>Sharp</code>
|
||||
|
||||
Extend / pad / extrude one or more edges of the image with either
|
||||
the provided background colour or pixels derived from the image.
|
||||
This operation will always occur after resizing and extraction, if any.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| extend | <code>number</code> \| <code>Object</code> | | single pixel count to add to all edges or an Object with per-edge counts |
|
||||
| [extend.top] | <code>number</code> | <code>0</code> | |
|
||||
| [extend.left] | <code>number</code> | <code>0</code> | |
|
||||
| [extend.bottom] | <code>number</code> | <code>0</code> | |
|
||||
| [extend.right] | <code>number</code> | <code>0</code> | |
|
||||
| [extend.extendWith] | <code>String</code> | <code>'background'</code> | populate new pixels using this method, one of: background, copy, repeat, mirror. |
|
||||
| [extend.background] | <code>String</code> \| <code>Object</code> | <code>{r: 0, g: 0, b: 0, alpha: 1}</code> | background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black without transparency. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
// Resize to 140 pixels wide, then add 10 transparent pixels
|
||||
// to the top, left and right edges and 20 to the bottom edge
|
||||
sharp(input)
|
||||
.resize(140)
|
||||
.extend({
|
||||
top: 10,
|
||||
bottom: 20,
|
||||
left: 10,
|
||||
right: 10,
|
||||
background: { r: 0, g: 0, b: 0, alpha: 0 }
|
||||
})
|
||||
...
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Add a row of 10 red pixels to the bottom
|
||||
sharp(input)
|
||||
.extend({
|
||||
bottom: 10,
|
||||
background: 'red'
|
||||
})
|
||||
...
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Extrude image by 8 pixels to the right, mirroring existing right hand edge
|
||||
sharp(input)
|
||||
.extend({
|
||||
right: 8,
|
||||
background: 'mirror'
|
||||
})
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
## extract
|
||||
> extract(options) ⇒ <code>Sharp</code>
|
||||
|
||||
Extract/crop a region of the image.
|
||||
|
||||
- Use `extract` before `resize` for pre-resize extraction.
|
||||
- Use `extract` after `resize` for post-resize extraction.
|
||||
- Use `extract` twice and `resize` once for extract-then-resize-then-extract in a fixed operation order.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| options | <code>Object</code> | describes the region to extract using integral pixel values |
|
||||
| options.left | <code>number</code> | zero-indexed offset from left edge |
|
||||
| options.top | <code>number</code> | zero-indexed offset from top edge |
|
||||
| options.width | <code>number</code> | width of region to extract |
|
||||
| options.height | <code>number</code> | height of region to extract |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.extract({ left: left, top: top, width: width, height: height })
|
||||
.toFile(output, function(err) {
|
||||
// Extract a region of the input image, saving in the same format.
|
||||
});
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
sharp(input)
|
||||
.extract({ left: leftOffsetPre, top: topOffsetPre, width: widthPre, height: heightPre })
|
||||
.resize(width, height)
|
||||
.extract({ left: leftOffsetPost, top: topOffsetPost, width: widthPost, height: heightPost })
|
||||
.toFile(output, function(err) {
|
||||
// Extract a region, resize, then extract from the resized image
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## trim
|
||||
> trim([options]) ⇒ <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.
|
||||
|
||||
Images with an alpha channel will use the combined bounding box of alpha and non-alpha channels.
|
||||
|
||||
If the result of this operation would trim an image to nothing then no change is made.
|
||||
|
||||
The `info` response Object will contain `trimOffsetLeft` and `trimOffsetTop` properties.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> | | |
|
||||
| [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. |
|
||||
| [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**
|
||||
```js
|
||||
// Trim pixels with a colour similar to that of the top-left pixel.
|
||||
await sharp(input)
|
||||
.trim()
|
||||
.toFile(output);
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Trim pixels with the exact same colour as that of the top-left pixel.
|
||||
await sharp(input)
|
||||
.trim({
|
||||
threshold: 0
|
||||
})
|
||||
.toFile(output);
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Assume input is line art and trim only pixels with a similar colour to red.
|
||||
const output = await sharp(input)
|
||||
.trim({
|
||||
background: "#FF0000",
|
||||
lineArt: true
|
||||
})
|
||||
.toBuffer();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
// Trim all "yellow-ish" pixels, being more lenient with the higher threshold.
|
||||
const output = await sharp(input)
|
||||
.trim({
|
||||
background: "yellow",
|
||||
threshold: 42,
|
||||
})
|
||||
.toBuffer();
|
||||
```
|
232
docs/src/content/docs/api-utility.md
Normal file
232
docs/src/content/docs/api-utility.md
Normal file
@ -0,0 +1,232 @@
|
||||
---
|
||||
# This file was auto-generated from JSDoc in lib/utility.js
|
||||
title: Global properties
|
||||
---
|
||||
|
||||
## versions
|
||||
> versions
|
||||
|
||||
An Object containing the version numbers of sharp, libvips
|
||||
and (when using prebuilt binaries) its dependencies.
|
||||
|
||||
|
||||
**Example**
|
||||
```js
|
||||
console.log(sharp.versions);
|
||||
```
|
||||
|
||||
|
||||
## interpolators
|
||||
> interpolators : <code>enum</code>
|
||||
|
||||
An Object containing the available interpolators and their proper values
|
||||
|
||||
|
||||
**Read only**: true
|
||||
**Properties**
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| nearest | <code>string</code> | <code>"nearest"</code> | [Nearest neighbour interpolation](http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation). Suitable for image enlargement only. |
|
||||
| bilinear | <code>string</code> | <code>"bilinear"</code> | [Bilinear interpolation](http://en.wikipedia.org/wiki/Bilinear_interpolation). Faster than bicubic but with less smooth results. |
|
||||
| bicubic | <code>string</code> | <code>"bicubic"</code> | [Bicubic interpolation](http://en.wikipedia.org/wiki/Bicubic_interpolation) (the default). |
|
||||
| locallyBoundedBicubic | <code>string</code> | <code>"lbb"</code> | [LBB interpolation](https://github.com/libvips/libvips/blob/master/libvips/resample/lbb.cpp#L100). Prevents some "[acutance](http://en.wikipedia.org/wiki/Acutance)" but typically reduces performance by a factor of 2. |
|
||||
| nohalo | <code>string</code> | <code>"nohalo"</code> | [Nohalo interpolation](http://eprints.soton.ac.uk/268086/). Prevents acutance but typically reduces performance by a factor of 3. |
|
||||
| vertexSplitQuadraticBasisSpline | <code>string</code> | <code>"vsqbs"</code> | [VSQBS interpolation](https://github.com/libvips/libvips/blob/master/libvips/resample/vsqbs.cpp#L48). Prevents "staircasing" when enlarging. |
|
||||
|
||||
|
||||
|
||||
## format
|
||||
> format ⇒ <code>Object</code>
|
||||
|
||||
An Object containing nested boolean values representing the available input and output formats/methods.
|
||||
|
||||
|
||||
**Example**
|
||||
```js
|
||||
console.log(sharp.format);
|
||||
```
|
||||
|
||||
|
||||
## queue
|
||||
> queue
|
||||
|
||||
An EventEmitter that emits a `change` event when a task is either:
|
||||
- queued, waiting for _libuv_ to provide a worker thread
|
||||
- complete
|
||||
|
||||
|
||||
**Example**
|
||||
```js
|
||||
sharp.queue.on('change', function(queueLength) {
|
||||
console.log('Queue contains ' + queueLength + ' task(s)');
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## cache
|
||||
> cache([options]) ⇒ <code>Object</code>
|
||||
|
||||
Gets or, when options are provided, sets the limits of _libvips'_ operation cache.
|
||||
Existing entries in the cache will be trimmed after any change in limits.
|
||||
This method always returns cache statistics,
|
||||
useful for determining how much working memory is required for a particular task.
|
||||
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> \| <code>boolean</code> | <code>true</code> | Object with the following attributes, or boolean where true uses default cache settings and false removes all caching |
|
||||
| [options.memory] | <code>number</code> | <code>50</code> | is the maximum memory in MB to use for this cache |
|
||||
| [options.files] | <code>number</code> | <code>20</code> | is the maximum number of files to hold open |
|
||||
| [options.items] | <code>number</code> | <code>100</code> | is the maximum number of operations to cache |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const stats = sharp.cache();
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
sharp.cache( { items: 200 } );
|
||||
sharp.cache( { files: 0 } );
|
||||
sharp.cache(false);
|
||||
```
|
||||
|
||||
|
||||
## concurrency
|
||||
> concurrency([concurrency]) ⇒ <code>number</code>
|
||||
|
||||
Gets or, when a concurrency is provided, sets
|
||||
the maximum number of threads _libvips_ should use to process _each image_.
|
||||
These are from a thread pool managed by glib,
|
||||
which helps avoid the overhead of creating new threads.
|
||||
|
||||
This method always returns the current concurrency.
|
||||
|
||||
The default value is the number of CPU cores,
|
||||
except when using glibc-based Linux without jemalloc,
|
||||
where the default is `1` to help reduce memory fragmentation.
|
||||
|
||||
A value of `0` will reset this to the number of CPU cores.
|
||||
|
||||
Some image format libraries spawn additional threads,
|
||||
e.g. libaom manages its own 4 threads when encoding AVIF images,
|
||||
and these are independent of the value set here.
|
||||
|
||||
:::note
|
||||
Further [control over performance](/performance) is available.
|
||||
:::
|
||||
|
||||
|
||||
**Returns**: <code>number</code> - concurrency
|
||||
|
||||
| Param | Type |
|
||||
| --- | --- |
|
||||
| [concurrency] | <code>number</code> |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const threads = sharp.concurrency(); // 4
|
||||
sharp.concurrency(2); // 2
|
||||
sharp.concurrency(0); // 4
|
||||
```
|
||||
|
||||
|
||||
## counters
|
||||
> counters() ⇒ <code>Object</code>
|
||||
|
||||
Provides access to internal task counters.
|
||||
- queue is the number of tasks this module has queued waiting for _libuv_ to provide a worker thread from its pool.
|
||||
- process is the number of resize tasks currently being processed.
|
||||
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const counters = sharp.counters(); // { queue: 2, process: 4 }
|
||||
```
|
||||
|
||||
|
||||
## simd
|
||||
> simd([simd]) ⇒ <code>boolean</code>
|
||||
|
||||
Get and set use of SIMD vector unit instructions.
|
||||
Requires libvips to have been compiled with highway support.
|
||||
|
||||
Improves the performance of `resize`, `blur` and `sharpen` operations
|
||||
by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
|
||||
|
||||
|
||||
|
||||
| Param | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| [simd] | <code>boolean</code> | <code>true</code> |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const simd = sharp.simd();
|
||||
// simd is `true` if the runtime use of highway is currently enabled
|
||||
```
|
||||
**Example**
|
||||
```js
|
||||
const simd = sharp.simd(false);
|
||||
// prevent libvips from using highway at runtime
|
||||
```
|
||||
|
||||
|
||||
## block
|
||||
> block(options)
|
||||
|
||||
Block libvips operations at runtime.
|
||||
|
||||
This is in addition to the `VIPS_BLOCK_UNTRUSTED` environment variable,
|
||||
which when set will block all "untrusted" operations.
|
||||
|
||||
|
||||
**Since**: 0.32.4
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| options | <code>Object</code> | |
|
||||
| options.operation | <code>Array.<string></code> | List of libvips low-level operation names to block. |
|
||||
|
||||
**Example** *(Block all TIFF input.)*
|
||||
```js
|
||||
sharp.block({
|
||||
operation: ['VipsForeignLoadTiff']
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## unblock
|
||||
> unblock(options)
|
||||
|
||||
Unblock libvips operations at runtime.
|
||||
|
||||
This is useful for defining a list of allowed operations.
|
||||
|
||||
|
||||
**Since**: 0.32.4
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| options | <code>Object</code> | |
|
||||
| options.operation | <code>Array.<string></code> | List of libvips low-level operation names to unblock. |
|
||||
|
||||
**Example** *(Block all input except WebP from the filesystem.)*
|
||||
```js
|
||||
sharp.block({
|
||||
operation: ['VipsForeignLoad']
|
||||
});
|
||||
sharp.unblock({
|
||||
operation: ['VipsForeignLoadWebpFile']
|
||||
});
|
||||
```
|
||||
**Example** *(Block all input except JPEG and PNG from a Buffer or Stream.)*
|
||||
```js
|
||||
sharp.block({
|
||||
operation: ['VipsForeignLoad']
|
||||
});
|
||||
sharp.unblock({
|
||||
operation: ['VipsForeignLoadJpegBuffer', 'VipsForeignLoadPngBuffer']
|
||||
});
|
||||
```
|
1
docs/src/content/docs/changelog/_meta.yml
Normal file
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user