Docs: cross-link removeAlpha and flatten

This commit is contained in:
Lovell Fuller 2021-05-23 18:46:23 +01:00
parent ed3377cb2d
commit 1b4d1521e0
5 changed files with 39 additions and 29 deletions

View File

@ -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
@ -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
@ -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**
@ -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
@ -71,7 +73,7 @@ sharp(input)
});
```
* Throws **[Error][2]** Invalid channel
* Throws **[Error][3]** Invalid channel
Returns **Sharp**
@ -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**
@ -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
@ -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/Error
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[5]: https://nodejs.org/api/buffer.html
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[6]: https://nodejs.org/api/buffer.html
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

View File

@ -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]?**
@ -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
@ -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]?**
@ -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://nodejs.org/api/buffer.html
[9]: https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE|CLAHE}
[10]: https://nodejs.org/api/buffer.html

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,8 @@ const bool = {
/**
* Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel.
*
* See also {@link /api-operation#flatten|flatten}.
*
* @example
* sharp('rgba.png')
* .removeAlpha()

View File

@ -270,6 +270,8 @@ function blur (sigma) {
/**
* Merge alpha transparency channel, if any, with a background, then remove the alpha channel.
*
* See also {@link /api-channel#removealpha|removeAlpha}.
*
* @example
* await sharp(rgbaInput)
* .flatten({ background: '#F0A703' })
@ -351,11 +353,10 @@ function normalize (normalize) {
}
/**
* 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}).
*
* 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
* This will, in general, enhance the clarity of the image by bringing out darker details.
*
* @since 0.28.3
*