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

PNG to WEBP loses alpha channel #756

Open
clintandrewhall opened this issue Oct 28, 2024 · 1 comment
Open

PNG to WEBP loses alpha channel #756

clintandrewhall opened this issue Oct 28, 2024 · 1 comment

Comments

@clintandrewhall
Copy link

clintandrewhall commented Oct 28, 2024

I have a PNG file I'm resizing and converting to WEBP:

const images = import.meta.glob<{ default: ImageOutputMetadata }>('logos/*.png', {
  query: { w: '40', as: 'metadata', format: 'webp' },
  eager: true,
});

So this PNG with transparency:

elastic

Results in a WEBP file that renders with no alpha channel:

image

Even though the metadata claims it does:

channels: 3
depth: "uchar"
format: "webp"
hasAlpha: true
hasProfile: false
height: 40
isProgressive: false
space: "srgb"
src: "/@imagetools/2ea211769af126686faeadb5c2b675b88f439323"
width: 40

Any ideas what I'm doing wrong here?

@clintandrewhall
Copy link
Author

clintandrewhall commented Oct 28, 2024

Just tried with a GIF with the same result:

Screenshot 2024-10-28 at 10 33 08 AM

elastic

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

No branches or pull requests

1 participant