You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The quality of the optimized image, an integer between `1` and `100`, where `100` is the best quality and therefore largest file size. Defaults to `75`.
249
249
250
+
If the [`qualities`](#qualities) configuration is defined in `next.config.js`, the `quality` prop must match one of the values defined in the configuration.
251
+
252
+
> **Good to know**: If the original source image was already low quality, setting the quality prop too high could cause the resulting optimized image to be larger than the original source image.
253
+
250
254
### `priority`
251
255
252
256
```js
@@ -672,6 +676,20 @@ module.exports = {
672
676
}
673
677
```
674
678
679
+
### `qualities`
680
+
681
+
The default [Image Optimization API](#loader) will automatically allow all qualities from 1 to 100. If you wish to restrict the allowed qualities, you can add configuration to `next.config.js`.
682
+
683
+
```js filename="next.config.js"
684
+
module.exports= {
685
+
images: {
686
+
qualities: [25, 50, 75],
687
+
},
688
+
}
689
+
```
690
+
691
+
In this example above, only three qualities are allowed: 25, 50, and 75. If the [`quality`](#quality) prop does not match a value in this array, the image will fail with 400 Bad Request.
692
+
675
693
### `formats`
676
694
677
695
The default [Image Optimization API](#loader) will automatically detect the browser's supported image formats via the request's `Accept` header.
One of your pages that leverages the `next/image` component, passed a `quality` value that isn't defined in the `images.qualities` property in `next.config.js`.
8
+
9
+
## Possible Ways to Fix It
10
+
11
+
Add an entry to `images.qualities` array in `next.config.js` with the expected value. For example:
0 commit comments