Image Optimization Quickstart
Learn how you can leverage Vercel Image Optimization in your projects.The following examples show how you can optimize your images on Vercel using your framework's image component. Use the framework switcher to see examples for your framework choice.
Vercel Image Optimization works out of the box with Next.js, Nuxt, SvelteKit, and Astro.
Next.js provides a built-in
next/image
component.app/example/page.tsximport Image from 'next/image';
This component takes the following required props:
src
: The URL of the image to be loadedalt
: A short description of the imagewidth
: The width of the imageheight
: The height of the image
When using local images you do not need to provide the
width
andheight
props. These values will be automatically determined based on the imported image.The below example uses a remote image stored in a
/public/images/
folder, and has thewidth
andheight
props applied:app/example/page.tsx<Image src="https://images.unsplash.com/photo-1627843240167-b1f9d28f732e" alt="Picture of a triangle" width={500} height={500} />
If there are some images that you wish to not optimize (for example, if the URL contains a token), you can use the unoptimized prop to disable image optimization on some or all of your images.
For more information on all props, caching behavior, and responsive images, visit the
next/image
documentation.Push your changes and deploy your Next.js application to Vercel.
When deployed to Vercel, this component automatically optimizes your images on-demand and serves them from the Vercel Edge Network.
Was this helpful?