Art Direction for Images
Optimizing image crops for different viewport sizes
What is Art Direction?
Art direction for responsive images means showing different image crops or versions based on the viewport size, ensuring the most important part of an image is visible across all devices.
Unlike simple responsive images that just resize, art-directed images can have different aspect ratios, crops, and focal points optimized for each screen size.
Benefits:
- Better visual storytelling across devices
- Improved user experience on mobile
- Ensures important image details are visible
- Optimizes image composition for each viewport
Art Direction vs. Simple Responsive
Compare the difference between art-directed images and simple responsive images
How to Implement Art Direction
A guide to using the ArtDirectedImage component
// Define breakpoints for different viewport sizes const imageBreakpoints = [ { // Mobile version src: "/images/mobile.webp", width: 400, height: 500, maxWidth: 639, focalPoint: { x: 50, y: 30 } }, { // Desktop version src: "/images/desktop.webp", width: 800, height: 500, minWidth: 640, focalPoint: { x: 40, y: 50 } } ]; // Use the component <ArtDirectedImage breakpoints={imageBreakpoints} alt="Description of the image" priority={true} />
Real-World Applications
Where art direction makes a significant difference
Hero images often need different crops to maintain impact across devices. On mobile, a tighter crop on the subject works better than a wide landscape.
Product images can show the full product on desktop but focus on key features or details when viewed on smaller screens.
Group photos can show the entire team on desktop but focus on key individuals when space is limited on mobile devices.