Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: fix ensuareAlpha alpha argument #4089

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/api-channel.md
Expand Up @@ -21,7 +21,7 @@ sharp('rgba.png')

Ensure the output image has an alpha transparency channel.
If missing, the added alpha channel will have the specified
transparency level, defaulting to fully-opaque (1).
transparency level, defaulting to fully-transparent (1).
This is a no-op if the image already has an alpha channel.


Expand All @@ -33,18 +33,18 @@ This is a no-op if the image already has an alpha channel.

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [alpha] | <code>number</code> | <code>1</code> | alpha transparency level (0=fully-transparent, 1=fully-opaque) |
| [alpha] | <code>number</code> | <code>1</code> | alpha transparency level (0=fully-opaque, 1=fully-transparent) |

**Example**
```js
// rgba.png will be a 4 channel image with a fully-opaque alpha channel
// rgba.png will be a 4 channel image with a fully-transparent alpha channel
await sharp('rgb.jpg')
.ensureAlpha()
.toFile('rgba.png')
```
**Example**
```js
// rgba is a 4 channel image with a fully-transparent alpha channel
// rgba is a 4 channel image with a fully-opaque alpha channel
const rgba = await sharp(rgb)
.ensureAlpha(0)
.toBuffer();
Expand Down Expand Up @@ -133,4 +133,4 @@ sharp('3-channel-rgb-input.png')
// If `I(1,1) = [247, 170, 14] = [0b11110111, 0b10101010, 0b00001111]`
// then `O(1,1) = 0b11110111 & 0b10101010 & 0b00001111 = 0b00000010 = 2`.
});
```
```