-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
@astrojs/image fails to convert black and transparent png to visible jpg image #4625
Copy link
Copy link
Closed
Labels
- P2: nice to haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)
Description
What version of astro are you using?
1.1.5
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
pnpm
What operating system are you using?
Windows WSL2
Describe the Bug
@astrojs/image version: 0.5.0
When trying to generate an optimized version of a transparent PNG image with black contents (for instance a logo) in a format that doesn't support transparency, the background becomes black and the content becomes invisible.
This is because there is no option to set the background color when the alpha channel is lost due to format conversion.
Link to Minimal Reproducible Example
https://github.com/beeb/astrojs-image-repro
Participation
- I am willing to submit a pull request for this issue.
Suggestion
Add a background prop to be passed to sharp's flatten method.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- P2: nice to haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)