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

Support converting + optimizing SVGs to other image formats #878

Open
johnpyp opened this issue Apr 29, 2024 · 2 comments
Open

Support converting + optimizing SVGs to other image formats #878

johnpyp opened this issue Apr 29, 2024 · 2 comments

Comments

@johnpyp
Copy link

johnpyp commented Apr 29, 2024

Is your feature request related to a problem? Please describe.
SVGs are often used as the highest-fidelity exports from things like Figma - even a lossless image export doesn't really match the quality of an SVG because it can be forever-scaled up while being the same fidelity. For that reason, we try to use SVGs as the source image in source-code too.

However, next-export-optimize-images doesn't currently support optimizing svgs to other file formats like avif/webp (seems like due to #658)

Describe the solution you'd like
A clear and concise description of what you want to happen.
It would be great if the library supported optimizing SVGs, actually the opposite of #658. NextJS now supports this with a flag https://nextjs.org/docs/app/api-reference/components/image#dangerouslyallowsvg

Describe alternatives you've considered
Pre-processing the SVGs to an intermediate format - but this kind of defeats the whole purpose of the automatic optimization in the first place :)

Additional context
N/A

@johnpyp johnpyp changed the title Support optimizing SVGs Support converting + optimizing SVGs to other image formats Apr 29, 2024
@dc7290
Copy link
Owner

dc7290 commented May 18, 2024

I see.
As a feature request, do you want to "change SVG images to AVIF or WEBP format when you specify them"?

@dc7290
Copy link
Owner

dc7290 commented May 28, 2024

Incidentally, I think Next.js also just returns the buffer as it is without any optimisation for vector images like SVG.
https://github.com/vercel/next.js/blob/canary/packages/next/src/server/image-optimizer.ts#L594
I'm not sure what you mean by optimising SVG, but I think Figma, for example, can output without extra tags and IDs, so you might want to try using that.

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

No branches or pull requests

2 participants