Skip to content

Commit 67e927b

Browse files
committed
Docs: ensure all functions include method signature #3777
1 parent 9c7713e commit 67e927b

File tree

11 files changed

+140
-2
lines changed

11 files changed

+140
-2
lines changed

docs/api-channel.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
## removeAlpha
2+
> removeAlpha() ⇒ <code>Sharp</code>
3+
24
Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel.
35

46
See also [flatten](/api-operation#flatten).
@@ -15,6 +17,8 @@ sharp('rgba.png')
1517

1618

1719
## ensureAlpha
20+
> ensureAlpha([alpha]) ⇒ <code>Sharp</code>
21+
1822
Ensure the output image has an alpha transparency channel.
1923
If missing, the added alpha channel will have the specified
2024
transparency level, defaulting to fully-opaque (1).
@@ -48,6 +52,8 @@ const rgba = await sharp(rgb)
4852

4953

5054
## extractChannel
55+
> extractChannel(channel) ⇒ <code>Sharp</code>
56+
5157
Extract a single channel from a multi-channel image.
5258

5359

@@ -78,6 +84,8 @@ const [red1, red2, ...] = await sharp(input)
7884

7985

8086
## joinChannel
87+
> joinChannel(images, options) ⇒ <code>Sharp</code>
88+
8189
Join one or more channels to the image.
8290
The meaning of the added channels depends on the output colourspace, set with `toColourspace()`.
8391
By default the output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
@@ -102,6 +110,8 @@ For raw pixel input, the `options` object should contain a `raw` attribute, whic
102110

103111

104112
## bandbool
113+
> bandbool(boolOp) ⇒ <code>Sharp</code>
114+
105115
Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.
106116

107117

docs/api-colour.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
## tint
2+
> tint(rgb) ⇒ <code>Sharp</code>
3+
24
Tint the image using the provided chroma while preserving the image luminance.
35
An alpha channel may be present and will be unchanged by the operation.
46

@@ -21,6 +23,8 @@ const output = await sharp(input)
2123

2224

2325
## greyscale
26+
> greyscale([greyscale]) ⇒ <code>Sharp</code>
27+
2428
Convert to 8-bit greyscale; 256 shades of grey.
2529
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.
2630
By default the output image will be web-friendly sRGB and contain three (identical) color channels.
@@ -41,6 +45,8 @@ const output = await sharp(input).greyscale().toBuffer();
4145

4246

4347
## grayscale
48+
> grayscale([grayscale]) ⇒ <code>Sharp</code>
49+
4450
Alternative spelling of `greyscale`.
4551

4652

@@ -52,6 +58,8 @@ Alternative spelling of `greyscale`.
5258

5359

5460
## pipelineColourspace
61+
> pipelineColourspace([colourspace]) ⇒ <code>Sharp</code>
62+
5563
Set the pipeline colourspace.
5664

5765
The input image will be converted to the provided colourspace at the start of the pipeline.
@@ -82,6 +90,8 @@ await sharp(input)
8290

8391

8492
## pipelineColorspace
93+
> pipelineColorspace([colorspace]) ⇒ <code>Sharp</code>
94+
8595
Alternative spelling of `pipelineColourspace`.
8696

8797

@@ -97,6 +107,8 @@ Alternative spelling of `pipelineColourspace`.
97107

98108

99109
## toColourspace
110+
> toColourspace([colourspace]) ⇒ <code>Sharp</code>
111+
100112
Set the output colourspace.
101113
By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
102114

@@ -120,6 +132,8 @@ await sharp(input)
120132

121133

122134
## toColorspace
135+
> toColorspace([colorspace]) ⇒ <code>Sharp</code>
136+
123137
Alternative spelling of `toColourspace`.
124138

125139

docs/api-composite.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
## composite
2+
> composite(images) ⇒ <code>Sharp</code>
3+
24
Composite image(s) over the processed (resized, extracted etc.) image.
35

46
The images to composite must be the same size or smaller than the processed image.

docs/api-constructor.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
## Sharp
2+
> Sharp
3+
24

35
**Emits**: <code>Sharp#event:info</code>, <code>Sharp#event:warning</code>
46
<a name="new_Sharp_new"></a>
57

68
### new
9+
> new Sharp([input], [options])
10+
711
Constructor factory to create an instance of `sharp`, to which further methods are chained.
812

913
JPEG, PNG, WebP, GIF, AVIF or TIFF format image data can be streamed out from this object.
@@ -159,6 +163,8 @@ await sharp({
159163

160164

161165
## clone
166+
> clone() ⇒ [<code>Sharp</code>](#Sharp)
167+
162168
Take a "snapshot" of the Sharp instance, returning a new instance.
163169
Cloned instances inherit the input of their parent instance.
164170
This allows multiple output Streams and therefore multiple processing pipelines to share a single input Stream.

docs/api-input.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
## metadata
2+
> metadata([callback]) ⇒ <code>Promise.&lt;Object&gt;</code> \| <code>Sharp</code>
3+
24
Fast access to (uncached) image metadata without decoding any compressed pixel data.
35

46
This is read from the header of the input image.
@@ -81,6 +83,8 @@ function getNormalSize({ width, height, orientation }) {
8183

8284

8385
## stats
86+
> stats([callback]) ⇒ <code>Promise.&lt;Object&gt;</code>
87+
8488
Access to pixel-derived image statistics for every channel in the image.
8589
A `Promise` is returned when `callback` is not provided.
8690

docs/api-operation.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
## rotate
2+
> rotate([angle], [options]) ⇒ <code>Sharp</code>
3+
24
Rotate the output image by either an explicit angle
35
or auto-orient based on the EXIF `Orientation` tag.
46

@@ -57,6 +59,8 @@ const resizeThenRotate = await sharp(input)
5759

5860

5961
## flip
62+
> flip([flip]) ⇒ <code>Sharp</code>
63+
6064
Mirror the image vertically (up-down) about the x-axis.
6165
This always occurs before rotation, if any.
6266

@@ -75,6 +79,8 @@ const output = await sharp(input).flip().toBuffer();
7579

7680

7781
## flop
82+
> flop([flop]) ⇒ <code>Sharp</code>
83+
7884
Mirror the image horizontally (left-right) about the y-axis.
7985
This always occurs before rotation, if any.
8086

@@ -91,6 +97,8 @@ const output = await sharp(input).flop().toBuffer();
9197

9298

9399
## affine
100+
> affine(matrix, [options]) ⇒ <code>Sharp</code>
101+
94102
Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
95103

96104
You must provide an array of length 4 or a 2x2 affine transformation matrix.
@@ -142,6 +150,8 @@ inputStream
142150

143151

144152
## sharpen
153+
> sharpen([options], [flat], [jagged]) ⇒ <code>Sharp</code>
154+
145155
Sharpen the image.
146156

147157
When used without parameters, performs a fast, mild sharpen of the output image.
@@ -193,6 +203,8 @@ const data = await sharp(input)
193203

194204

195205
## median
206+
> median([size]) ⇒ <code>Sharp</code>
207+
196208
Apply median filter.
197209
When used without parameters the default window is 3x3.
198210

@@ -217,6 +229,8 @@ const output = await sharp(input).median(5).toBuffer();
217229

218230

219231
## blur
232+
> blur([sigma]) ⇒ <code>Sharp</code>
233+
220234
Blur the image.
221235

222236
When used without parameters, performs a fast 3x3 box blur (equivalent to a box linear filter).
@@ -248,6 +262,8 @@ const gaussianBlurred = await sharp(input)
248262

249263

250264
## flatten
265+
> flatten([options]) ⇒ <code>Sharp</code>
266+
251267
Merge alpha transparency channel, if any, with a background, then remove the alpha channel.
252268

253269
See also [removeAlpha](/api-channel#removealpha).
@@ -268,6 +284,8 @@ await sharp(rgbaInput)
268284

269285

270286
## unflatten
287+
> unflatten()
288+
271289
Ensure the image has an alpha channel
272290
with all white pixel values made fully transparent.
273291

@@ -293,6 +311,8 @@ await sharp(rgbInput)
293311

294312

295313
## gamma
314+
> gamma([gamma], [gammaOut]) ⇒ <code>Sharp</code>
315+
296316
Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of `1/gamma`
297317
then increasing the encoding (brighten) post-resize at a factor of `gamma`.
298318
This can improve the perceived brightness of a resized image in non-linear colour spaces.
@@ -315,6 +335,8 @@ Supply a second argument to use a different output gamma value, otherwise the fi
315335

316336

317337
## negate
338+
> negate([options]) ⇒ <code>Sharp</code>
339+
318340
Produce the "negative" of the image.
319341

320342

@@ -339,6 +361,8 @@ const output = await sharp(input)
339361

340362

341363
## normalise
364+
> normalise([options]) ⇒ <code>Sharp</code>
365+
342366
Enhance output image contrast by stretching its luminance to cover a full dynamic range.
343367

344368
Uses a histogram-based approach, taking a default range of 1% to 99% to reduce sensitivity to noise at the extremes.
@@ -369,6 +393,8 @@ const output = await sharp(input)
369393

370394

371395
## normalize
396+
> normalize([options]) ⇒ <code>Sharp</code>
397+
372398
Alternative spelling of normalise.
373399

374400

@@ -388,6 +414,8 @@ const output = await sharp(input)
388414

389415

390416
## clahe
417+
> clahe(options) ⇒ <code>Sharp</code>
418+
391419
Perform contrast limiting adaptive histogram equalization
392420
[CLAHE](https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE).
393421

@@ -419,6 +447,8 @@ const output = await sharp(input)
419447

420448

421449
## convolve
450+
> convolve(kernel) ⇒ <code>Sharp</code>
451+
422452
Convolve the image with the specified kernel.
423453

424454

@@ -453,6 +483,8 @@ sharp(input)
453483

454484

455485
## threshold
486+
> threshold([threshold], [options]) ⇒ <code>Sharp</code>
487+
456488
Any pixel value greater than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
457489

458490

@@ -471,6 +503,8 @@ Any pixel value greater than or equal to the threshold value will be set to 255,
471503

472504

473505
## boolean
506+
> boolean(operand, operator, [options]) ⇒ <code>Sharp</code>
507+
474508
Perform a bitwise boolean operation with operand image.
475509

476510
This operation creates an output image where each pixel is the result of
@@ -495,6 +529,8 @@ the selected bitwise boolean `operation` between the corresponding pixels of the
495529

496530

497531
## linear
532+
> linear([a], [b]) ⇒ <code>Sharp</code>
533+
498534
Apply the linear formula `a` * input + `b` to the image to adjust image levels.
499535

500536
When a single number is provided, it will be used for all image channels.
@@ -529,6 +565,8 @@ await sharp(rgbInput)
529565

530566

531567
## recomb
568+
> recomb(inputMatrix) ⇒ <code>Sharp</code>
569+
532570
Recombine the image with the specified matrix.
533571

534572

@@ -559,6 +597,8 @@ sharp(input)
559597

560598

561599
## modulate
600+
> modulate([options]) ⇒ <code>Sharp</code>
601+
562602
Transforms the image using brightness, saturation, hue rotation, and lightness.
563603
Brightness and lightness both operate on luminance, with the difference being that
564604
brightness is multiplicative whereas lightness is additive.

0 commit comments

Comments
 (0)