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

It's possiable to configure the default format for <NuxtImg> ? #1464

Open
JianJroh opened this issue Aug 30, 2024 · 2 comments
Open

It's possiable to configure the default format for <NuxtImg> ? #1464

JianJroh opened this issue Aug 30, 2024 · 2 comments

Comments

@JianJroh
Copy link

I have seen https://image.nuxt.com/get-started/configuration#format.
But it seems to work only for <NuxtPicture>

@JianJroh JianJroh changed the title It's possiable to configure the default format for `<NuxtImg>? It's possiable to configure the default format for <NuxtImg> ? Aug 30, 2024
@adamkasper
Copy link

adamkasper commented Sep 30, 2024

have you checked the <NuxtImg /> source code? from what I’ve seen, it doesn’t seem like this is possible right now

<NuxtPicture /> has this: https://github.com/nuxt/image/blob/main/src/runtime/components/NuxtPicture.vue#L67

@IvanhoeGrozni
Copy link

IvanhoeGrozni commented Nov 4, 2024

You actually can do it, but you have to set it per-provider. IPX is NuxtImg's default provider, so this works:

image: {
  ipx: {
    modifiers: {
      format: "avif",
    },
  },
},

But it doesn't support SVG. So any SVG images will also be converted to a AVIF in this case, you can not override it on individual elements like this <NuxtImg format="svg" />, for example. :(

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

3 participants