Joan León PRO
⚡️ Web Performance Consultant | Speaker | Staff Frontend Engineer at @AdevintaSpain | @GoogleDevExpert in #WebPerf | @cloudinary Ambassador
import Image from 'next/image'
export default function Page() {
return (
<Image
src="/vercel.png"
width={500}
height={500}
alt="Picture of the author"
/>
)
}
<img
alt="Mountains"
width="700" height="475"
loading="lazy" decoding="async"
data-nimg="1"
style="color:transparent;width:100%;height:auto"
sizes="100vw"
srcset="/_next/image?url=...mountains.jpg&w=640&q=75 640w,
/_next/image?url=...mountains.jpg&w=750&q=75 750w,
/_next/image?url=...mountains.jpg&w=828&q=75 828w,
/_next/image?url=...mountains.jpg&w=1080&q=75 1080w,
/_next/image?url=...mountains.jpg&w=1200&q=75 1200w,
/_next/image?url=...mountains.a2eb1d50.jpg&w=1920&q=75 1920w,
/_next/image?url=...mountains.jpg&w=2048&q=75 2048w,
/_next/image?url=...mountains.jpg&w=3840&q=75 3840w"
src="/_next/image?url=...mountains.a2eb1d50.jpg&w=3840&q=75">
Responsive to viewport
🤔
The Next.js Image component extends the HTML <img>
element with features for automatic image optimization:
/ar_330:210,c_thumb,dpr_2.0,g_auto,w_250/
/c_mpad,h_900,w_1100,b_gen_fill/
import { CldImage } from 'next-cloudinary';
<CldImage
width="960"
height="600"
src="<Public ID>"
sizes="100vw"
alt="Description of my image"
/>
import { CldImage } from 'next-cloudinary';
<CldImage
width="600"
height="960"
src="/images/woman-headphones"
sizes="100vw"
alt="Woman with headphones"
/>
import { CldImage } from 'next-cloudinary';
<CldImage
width="600"
height="600"
src="/images/woman-headphones"
sizes="100vw"
alt="Woman with headphones"
crop="thumb"
gravity="auto"
/>
import { CldImage } from 'next-cloudinary';
<CldImage
width="600"
height="600"
src="/images/woman-headphones"
sizes="100vw"
alt="Woman with headphones"
crop="thumb"
gravity="faces"
/>
import { CldImage } from 'next-cloudinary';
<CldImage
width="600"
height="600"
src="/images/woman-headphones"
sizes="100vw"
alt="Woman with headphones"
crop="thumb"
gravity="faces"
zoom="0.5"
/>
import { CldImage } from 'next-cloudinary';
<CldImage
width="960"
height="600"
src="/images/woman-headphones"
sizes="100vw"
alt="Woman with headphones"
crop="pad"
fillBackground //Uses AI to extend image
/>
/c_pad,w_960,h_600/b_gen_fill,ar_960:600,w_960,c_pad/
/c_pad,w_1000,h_600/b_gen_fill,ar_1000:600,w_1000,c_pad/
By Joan León
We will dive into image optimization in Next.js projects through Cloudinary's powerful tool. You will discover how to improve the efficiency and performance of your website by optimizing, resizing and customizing your visual assets. Through practical examples, we will unveil the key techniques to turn image optimization into a competitive advantage, providing valuable insight on how to effectively integrate Cloudinary into your Next.js project.