Skip to main content
InterviewHubPRO
Section Overview
Q9

Question 9 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

18%
Astro Islands & SSR (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

How does Astro Image Optimization (`<Image />`) work?

senior LevelCode ExamplePerformanceDocker & ContainersAstro

In Simple Words: Astro includes a built-in image optimization service:

astro
---
import { Image } from 'astro:assets';
import myHero from '../assets/hero.jpg';
---

<!-- Automatically converts JPG/PNG to modern WebP/AVIF, generates srcset, and prevents CLS -->
<Image src={myHero} alt="Product Hero" width={800} height={400} format="webp" />

Prevents layout shifts (CLS) by automatically inferring width/height and compresses image bytes by up to 80%.