Images have always been a key part of the web. Our brains are able to interpret images much faster than text, which is why high-quality visuals drive conversions and user engagement.
That said, loading images efficiently at scale isn’t a little project for a quiet afternoon. It requires understanding of compression techniques, loading behavior, image decoding and image CDNs, adaptive media loading and caching.
This book will equip you with everything you need to know to optimize how you compress, serve and maintain images — boosting performance along the way. Jump to table of contents.
528 pages. High quality hardcover + eBook (PDF, ePUB, Kindle). Written by Addy Osmani. Shipping now.
About The Book
Next to videos, images are the heaviest, most requested assets on the web. Some of the biggest size savings and performance improvements can come through a better image optimization strategy. The fewer bytes a browser has to fetch, the less competition there is for a user’s bandwidth, and the quicker that critical image can be displayed, along with page’s content.
With the new Smashing book, Addy Osmani provides a practical modern guide to delivering high-quality images on the web — from formats and compression to delivery and maintenance.
The book focuses on what matters: modern approaches to image compression and image delivery, practical tools and techniques to automate optimization, responsive images, current and emerging image formats, how browsers load, decode and render images, CDNs, lazy-loading, adaptive media loading and how to optimize for Core Web Vitals. Everything in one, single, 528-pages book. Download a free PDF sample (12MB).
Written by Addy Osmani. Illustrated by Espen Brunborg and Nadia Snopek. Reviewers and contributors include Milica Mihajlija, Colin Bendell, Kornel Lesiński, Estelle Weyl, Jeremy Wagner, Tim Kadlec, Nolan O’Brien, Pat Meenan, Kristofer Baxter, Henri (Helvetica) Brisard, Houssein Djirdeh, Una Kravets, Ilya Grigorik, Elle Osmani, Leena Sohoni, Katie Hempenius, Jon Sneyers, and Mathias Bynens.
Table of Contents
- The Humble <img> Element+
- The humble
<img>element has gained some superpowers over the years. Given how central it is to image optimization on the web, let’s catch up on what it can do.
- Optimizing Image Quality+
- Most optimization tools allow you to set the level of quality you’re happy with. Lower quality reduces file size but can introduce artifacts, halos, or blocky degrading.
- Comparing Image Formats+
- Each new image format has a range of effectiveness if you compare and align on a consistent “quality” of experience. In this chapter, we will explore the challenge of defining quality and setting expectations when converting between formats.
- Color Management+
- Ideally, every screen and web browser in the world would display color in exactly the same way. Unfortunately, they don’t. Color management allows us to reach a compromise on displaying color through color models, spaces, and profiles.
- Image Decoding Performance+
- How quickly an image can be decoded determines how soon browsers can show it to the user. Keeping this efficient helps ensure a good user experience. Let’s dig deeper into image decoding to understand how browsers perform behind the scenes and how you can control decoding.
- Measuring Image Performance+
- In this chapter, we will look into how to use Lighthouse to audit for unoptimized images and how to monitor a web performance budget for images.
- The JPEG may well be the world’s most widely used image format. Let’s examine JPEG’s compression modes as these can have a significant impact on perceived performance.
- From the very basics to palette modes, index and alpha transparency, and compression tips, in this chapter we’ll take an in-depth look at PNGs.
- WebP is a relatively recent image format developed with the aim of offering lower file sizes for lossless and lossy compression at an acceptable visual quality. Let’s explore how to use WebP images in production today.
- There are a number of ways to implement SVGs in a web page. In this chapter, we’ll take a look at different approaches and at how to keep your SVGs lean and performant.
- Responsive Images+
- Using responsive images is a key part of delivering fully responsive web design. This chapter covers techniques for defining responsive images.
- Progressive Rendering Techniques+
- There are many progressive image loading techniques that can shorten perceived load time. In this chapter, we’ll look at different ways of progressively loading images to improve performance and the user experience.
- Optimizing Network Requests with Caching and …+
- Downloading files such as images or videos over the network can be slow and costly. HTTP caching, service workers, image spriting, and preloading help optimize network requests. Let’s explore how they work.
- Lazy-Loading Offscreen Images+
- Web pages often contain a large number of images, contributing to page bloat, data costs, and how fast a page can load. Let’s take a look at how lazy-loading offscreen images can help improve the situation.
- Replacing Animated GIFs+
- If you’re aiming to improve the loading performance of your pages, animated GIFs aren’t very compatible with that goal. But this is an area of loading performance where, without a lot of work, you can get significant gains without a loss of content quality.
- Image Content Delivery Networks+
- For sites with large traffic and a global reach, basic optimizations at build time are usually not enough. CDNs help teams to handle known static assets ahead of time as well as dynamic assets to improve load times and site reliability.
- HEIF and HEIC+
- While other image formats may offer broader compatibility, HEIF is worth being familiar with as you may have users wishing to work with this format on iOS.
- AVIF aims to produce high-quality compressed images that lose as little quality as possible during compression. Let’s dive deeper into its features, browser support, and performance.
- JPEG XL+
- JPEG XL is an advanced image format aiming to deliver very significant compression benefits over JPEG. In this chapter, we’ll take a closer look at what it has to offer.
- Comparing New Image File Formats+
- While the new image formats support roughly the same sets of capabilities, the strength of each differentiates between them. The tables in this chapter aim to offer a summary of some of the more important features and how well each format handles various image types.
- Delivering Light Media Experiences with Data Saver+
- Browsers with Data Saver features give users a chance to explicitly tell us that they want to use a site without consuming so much data. Let’s see how to make use of Data Saver to deliver light media experiences.
- Optimize Images for Core Web Vitals+
- Which metrics should you focus on to improve the user experience? Core Web Vitals focuses on three key aspects of user experience: page loading experience, interaction readiness, and the visual stability of the page. Let’s take a look at each one of them.
- Twitter’s Image Pipeline (Case Study)+
- Tweets are often accompanied by images to illustrate, amuse, and increase user engagement. That is why Twitter places so much emphasis on a strong image optimization process. This case study focuses on the different steps that Twitter has taken to load images faster while ensuring they are as impactful as intended.
About The Author
Frequently Asked Questions
If you have any questions, we are right here to answer them. We love our customers, and we’d love to help you in any way or just listen to your story. So please feel free to ask questions via @smashingmag on Twitter — we’ll get back to you right away. Just in case: here are answers to some frequently asked questions.
- How much does shipping cost to my country?+
No shipping costs — wherever you are in the world! We ship everywhere, worldwide, via airmail shipping. What you see is what you pay. No ifs or buts.
- Delivery times to my country?+
All books are shipped via airmail to keep delivery times as short as possible. You can check the anticipated delivery times for your country.
- Is the eBook included with print?+
Yes, of course! The eBook is always included with printed books, so you can start reading the eBook right away. All eBooks are available in usual formats — PDF, ePUB and Amazon Kindle.
- What payment methods are accepted?+
PayPal, VISA, MasterCard and American Express. Of course, we use a secure connection, with 256-bit AES encryption and a green GeoTrust Extended Validation SSL CA certificate. And no, we don’t store your credit card data on our servers. (Obviously.)
- Is there a money-back guarantee?+
Yes, absolutely! No risk at all — our 100-day full money-back guarantee keeps you safe. Don’t hesitate to return your purchase. You’ll get your money back without ifs or buts!
- I have a question that is not covered here.+
No worries! Please get in touch with us via the contact form. We would love to help you as soon as we possibly can!