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
Copy file name to clipboardExpand all lines: docs/basic-features/image-optimization.md
+21-15Lines changed: 21 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
description: Next.js supports built-in image optimization, as well as third party loaders for Imgix, Cloudinary, and more! Learn more here.
3
3
---
4
4
5
-
# Image Optimization
5
+
# Image Component and Image Optimization
6
6
7
7
<detailsopen>
8
8
<summary><b>Examples</b></summary>
@@ -50,14 +50,26 @@ export default Home
50
50
51
51
You can configure Image Optimization by using the `images` property in `next.config.js`.
52
52
53
-
### Sizes
53
+
### Device Sizes
54
54
55
-
You can specify a list of image widths to allow using the `sizes` property. Since images maintain their aspect ratio using the `width` and `height` attributes of the source image, there is no need to specify height in `next.config.js` – only the width. You can think of these as breakpoints.
55
+
You can specify a list of device width breakpoints using the `deviceSizes` property. Since images maintain their aspect ratio using the `width` and `height` attributes of the source image, there is no need to specify height in `next.config.js` – only the width. These values will be used by the browser to determine which size image should load.
56
56
57
57
```js
58
58
module.exports= {
59
59
images: {
60
-
sizes: [320, 420, 768, 1024, 1200],
60
+
deviceSizes: [320, 420, 768, 1024, 1200],
61
+
},
62
+
}
63
+
```
64
+
65
+
### Icon Sizes
66
+
67
+
You can specify a list of icon image widths using the `iconSizes` property. These widths should be smaller than the smallest value in `deviceSizes`. The purpose is for images that don't scale with the browser window, such as icons or badges. If `iconSizes` is not defined, then `deviceSizes` will be used.
68
+
69
+
```js
70
+
module.exports= {
71
+
images: {
72
+
iconSizes: [16, 32, 64],
61
73
},
62
74
}
63
75
```
@@ -90,10 +102,11 @@ module.exports = {
90
102
91
103
The following Image Optimization cloud providers are supported:
92
104
93
-
- Imgix - `loader: 'imgix'`
94
-
- Cloudinary - `loader: 'cloudinary'`
95
-
- Akamai - `loader: 'akamai'`
96
-
- Vercel - No configuration necessary
105
+
- When using `next start` or a custom server image optimization works automatically.
106
+
-[Vercel](https://vercel.com): Works automatically when you deploy on Vercel
0 commit comments