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

Conversation

gutenye
Copy link

@gutenye gutenye commented Apr 26, 2024

1 is full-transparent

@lovell
Copy link
Owner

lovell commented Apr 27, 2024

I'm unsure I understand this change as the current documentation is correct. Adding an alpha channel using a value of 0 produces a fully-transparent image.

The alpha channel relates to the ability to see whatever is behind the image. Perhaps you are thinking of a mask?

@lovell
Copy link
Owner

lovell commented May 9, 2024

Thanks for taking the time to open a PR - I'll close as the documentation is already correct in this regard.

@lovell lovell closed this May 9, 2024
@gutenye
Copy link
Author

gutenye commented May 10, 2024

@lovell you're right, the output file must be png.

If I use jpg as output, like below, it outputs a black image, what caused it? This gets me confused.

await sharp('rgb.jpg')
  .ensureAlpha(0)
  .toFile('output.jpg')

@lovell
Copy link
Owner

lovell commented May 10, 2024

JPEG images do not support an alpha channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants