mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Docs: clarify that flatten removes alpha channel #2601
This commit is contained in:
parent
9fc611f257
commit
f1f18fbb4a
@ -169,13 +169,21 @@ Returns **Sharp**
|
|||||||
|
|
||||||
## flatten
|
## 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
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][2]?**
|
- `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}`)
|
- `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**
|
Returns **Sharp**
|
||||||
|
|
||||||
## gamma
|
## gamma
|
||||||
|
File diff suppressed because one or more lines are too long
@ -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 {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.
|
* @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}
|
* @returns {Sharp}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user