网页
综合
更新时间 2026-11-16 04:29:43
Configuration · @nuxt/image · Nuxt Modules
自动蜘蛛
nuxt.com
正文约 3000 字
To configure the image module and customize its behavior, you can use the image property in your nuxt.config:
By default Nuxt Image adopts a composable approach. If you do not use the components no additional code will be added to your bundle. But if you wish to globally initialize an $img helper that will be available throughout your application, you can do so.
The quality for the generated image(s).
You can also override this option at the component level by using the quality prop.
You can use this option to configure the default format for your images used by <NuxtPicture>. The available formats are webp, avif, jpeg, jpg, png, and gif. The order of the formats is important, as the first format that is supported by the browser will be used. You can pass multiple values like ['avif', 'webp'].
You can also override this option at the component level by using the format prop.
List of predefined screen sizes.
These sizes will be used to generate resized and optimized versions of an image (for example, with the sizes modifier).
To enable image optimization on an external website, specify which domains are allowed to be optimized. This option will be used to detect whether a remote image should be optimized or not. This is needed to ensure that external URLs can't be abused.
Presets are collections of pre-defined configurations for your projects. Presets will help you to unify images all over your project.
In order to create and use a custom provider, you need to use the providers option and define your custom providers.
Default: ipx (or ipxStatic if used with a static nitro preset, such as if you are running nuxt generate)
We can specify default provider to be used when not specified in component or when calling $img.
You can set default modifiers for the selected provider.
Specify a value to work with devicePixelRatio > 1 (these are devices with retina display and others). You must specify for which devicePixelRatio values you want to adapt images.
You can read more about devicePixelRatio on MDN.
This option allows you to specify the location of the source images when using the ipx or ipxStatic provider.
For example you might want the source images in assets/images directory rather than the default public directory so the source images don't get copied into dist and deployed:
This option allows you to specify aliases for src.
When using the default ipx provider, URL aliases are shortened on the server-side. This is especially useful for optimizing external URLs and not including them in HTML.
When using other providers, aliases are resolved in runtime and included in HTML. (only the usage is simplified)
Both usage and output are simplified!
Plug-and-play image optimization for Nuxt apps. Resize and transform your images using the built-in optimizer or your favorite images CDN.
Discover how to use and configure the Nuxt Image component.
Stay updated on new releases and features, guides, and community updates.
Copyright © 2016-2026 Nuxt - MIT License
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。