Skip to content

Commit

Permalink
Docs: cross-link removeAlpha and flatten
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed May 23, 2021
1 parent ed3377c commit 1b4d152
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 29 deletions.
34 changes: 19 additions & 15 deletions docs/api-channel.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel.

See also [flatten][1].

### Examples

```javascript
Expand All @@ -25,7 +27,7 @@ This is a no-op if the image already has an alpha channel.

### Parameters

* `alpha` **[number][1]** alpha transparency level (0=fully-transparent, 1=fully-opaque) (optional, default `1`)
* `alpha` **[number][2]** alpha transparency level (0=fully-transparent, 1=fully-opaque) (optional, default `1`)

### Examples

Expand All @@ -43,7 +45,7 @@ const rgba = await sharp(rgb)
.toBuffer();
```

* Throws **[Error][2]** Invalid alpha transparency level
* Throws **[Error][3]** Invalid alpha transparency level

Returns **Sharp**

Expand All @@ -57,7 +59,7 @@ Extract a single channel from a multi-channel image.

### Parameters

* `channel` **([number][1] | [string][3])** zero-indexed channel/band number to extract, or `red`, `green`, `blue` or `alpha`.
* `channel` **([number][2] | [string][4])** zero-indexed channel/band number to extract, or `red`, `green`, `blue` or `alpha`.

### Examples

Expand All @@ -71,7 +73,7 @@ sharp(input)
});
```

* Throws **[Error][2]** Invalid channel
* Throws **[Error][3]** Invalid channel

Returns **Sharp**

Expand All @@ -90,12 +92,12 @@ For raw pixel input, the `options` object should contain a `raw` attribute, whic

### Parameters

* `images` **([Array][4]<([string][3] | [Buffer][5])> | [string][3] | [Buffer][5])** one or more images (file paths, Buffers).
* `options` **[Object][6]** image options, see `sharp()` constructor.
* `images` **([Array][5]<([string][4] | [Buffer][6])> | [string][4] | [Buffer][6])** one or more images (file paths, Buffers).
* `options` **[Object][7]** image options, see `sharp()` constructor.

<!---->

* Throws **[Error][2]** Invalid parameters
* Throws **[Error][3]** Invalid parameters

Returns **Sharp**

Expand All @@ -105,7 +107,7 @@ Perform a bitwise boolean operation on all input image channels (bands) to produ

### Parameters

* `boolOp` **[string][3]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
* `boolOp` **[string][4]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.

### Examples

Expand All @@ -119,18 +121,20 @@ sharp('3-channel-rgb-input.png')
});
```

* Throws **[Error][2]** Invalid parameters
* Throws **[Error][3]** Invalid parameters

Returns **Sharp**

[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[1]: /api-operation#flatten

[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[5]: https://nodejs.org/api/buffer.html
[6]: https://nodejs.org/api/buffer.html

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
19 changes: 11 additions & 8 deletions docs/api-operation.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ Returns **Sharp**

Merge alpha transparency channel, if any, with a background, then remove the alpha channel.

See also [removeAlpha][8].

### Parameters

* `options` **[Object][2]?**
Expand All @@ -186,7 +188,7 @@ Merge alpha transparency channel, if any, with a background, then remove the alp

```javascript
await sharp(rgbaInput)
.flatten({background: '#F0A703' })
.flatten({ background: '#F0A703' })
.toBuffer();
```

Expand Down Expand Up @@ -245,11 +247,10 @@ Returns **Sharp**

## clahe

Perform contrast limiting adaptive histogram equalization (CLAHE)
Perform contrast limiting adaptive histogram equalization
({@link [https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE|CLAHE}][9]).

This will, in general, enhance the clarity of the image by bringing out
darker details. Please read more about CLAHE here:
[https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE][8]
This will, in general, enhance the clarity of the image by bringing out darker details.

### Parameters

Expand Down Expand Up @@ -332,7 +333,7 @@ the selected bitwise boolean `operation` between the corresponding pixels of the

### Parameters

* `operand` **([Buffer][9] | [string][3])** Buffer containing image data or string containing the path to an image file.
* `operand` **([Buffer][10] | [string][3])** Buffer containing image data or string containing the path to an image file.
* `operator` **[string][3]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
* `options` **[Object][2]?**

Expand Down Expand Up @@ -449,6 +450,8 @@ Returns **Sharp**

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[8]: https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE
[8]: /api-channel#removealpha

[9]: https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE|CLAHE}

[9]: https://nodejs.org/api/buffer.html
[10]: https://nodejs.org/api/buffer.html
Loading

0 comments on commit 1b4d152

Please sign in to comment.