Docs: clarify that flatten removes alpha channel #2601

This commit is contained in:
Lovell Fuller 2021-03-25 14:38:55 +00:00
parent 9fc611f257
commit f1f18fbb4a
3 changed files with 17 additions and 3 deletions

View File

@ -169,13 +169,21 @@ Returns **Sharp**
## flatten
Merge alpha transparency channel, if any, with a background.
Merge alpha transparency channel, if any, with a background, then remove the alpha channel.
### Parameters
- `options` **[Object][2]?**
- `options.background` **([string][3] \| [Object][2])** background colour, parsed by the [color][4] module, defaults to black. (optional, default `{r:0,g:0,b:0}`)
### Examples
```javascript
await sharp(rgbaInput)
.flatten('#F0A703')
.toBuffer();
```
Returns **Sharp**
## gamma

File diff suppressed because one or more lines are too long

View File

@ -268,7 +268,13 @@ function blur (sigma) {
}
/**
* Merge alpha transparency channel, if any, with a background.
* Merge alpha transparency channel, if any, with a background, then remove the alpha channel.
*
* @example
* await sharp(rgbaInput)
* .flatten('#F0A703')
* .toBuffer();
*
* @param {Object} [options]
* @param {string|Object} [options.background={r: 0, g: 0, b: 0}] - background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black.
* @returns {Sharp}