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

Implement option to switch set of formats on transparency #163

Closed
Snapstromegon opened this issue Nov 10, 2022 · 1 comment
Closed

Implement option to switch set of formats on transparency #163

Snapstromegon opened this issue Nov 10, 2022 · 1 comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request feature: `formats` option

Comments

@Snapstromegon
Copy link
Member

I want to build an image shortcode that does not output jpgs when the input image is/(might be) using transparency and instead use pngs.
Since the documentation points out that relying on the file extension isn't correct, I'd love to use the metadata sharp exposes to make this decision.

Right now I use it something like this:

Image(src, {
  widths: [256, 512, 1024, null],
  formats: [
    "avif",
    "webp",
    src.toLowerCase().endsWith(".png") ? "png" : "jpeg",
  ],
  outputDir: "_site/img/",
});

I don't know what the most elegant way of doing this would be, but I think such a feature would help more people than jsut me.

@zachleat zachleat added the enhancement New feature or request label Jan 30, 2023
@zachleat zachleat added this to the Eleventy Image v6.0.0 milestone Dec 13, 2024
@zachleat zachleat added the duplicate This issue or pull request already exists label Dec 13, 2024
@zachleat zachleat removed this from the Eleventy Image v6.0.0 milestone Dec 13, 2024
@zachleat
Copy link
Member

A bunch of discussion on this one already at #105

@zachleat zachleat closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request feature: `formats` option
Projects
None yet
Development

No branches or pull requests

2 participants