The web is becoming increasingly image rich. Between high-resolution mobile screens, Pinterest-style design, and big background graphics, the average image payload has more than doubled in the last three years. While visually appealing, these images carry a substantial performance cost, and — if not optimized correctly — can make a web experience slow and painful, no matter how beautiful it is.
In this tutorial we’ll discuss ways that let you provide the eye-pleasing experience you want without sacrificing your site’s performance.You’ll learn about the three primary aspects of image optimization:
- Image compression: how to best encode your images, delivering the same picture with the fewest bytes
- Image loading: once your files are as small as they can be, we’ll cover the best ways to make them show up quickly in the browser
- Operationalizing image optimization: different tools and techniques for integrating image optimization on your site
Talk given at Velocity Conf EU 2015: http://velocityconf.com/devops-web-performance-eu-2015/public/schedule/detail/45013
24. @guypod
BPG
• Less than 1 year old
• Lossless & Lossy
• Based on Video encoder HEVC
• H.265, successor of H.264
• Beat WebP & J2K in Mozilla Study
• Free (LGPL)
Fabrice Bellard
(Creator of ffmpeg)
25. @guypod
FLIF
• 0 years old
• Lossless
• Progressive
• Responsive Friendly
• No browser support
• Free (GPL)
Source: FLIF Creators
Jon Sneyers & Harshad RJ
32. @guypod
Using Custom Formats
Server Side, Single URL
GET /book.jpg GET /book.jpg
GET /book.jpg
Accept: image/webp
GET /book.webp
OriginCDN/Cache
33. @guypod
Using Custom Formats
Server Side, Single URL
GET /book.jxr
GET /book.jpg GET /book.jpg
GET /book.webp
GET /book.jpg
User-Agent: MSIE 10
Accept: image/jxr*
OriginCDN/Cache
* Spartan
GET /book.jpg
Accept: image/webp
60. @guypod
Which Breakpoints To Use?
How Big & Complex Are Your Images?
• Your Analytics
Source: Jason Grigsby,
“Sensible Jumps In Responsive Image File Sizes”
Width Height File Size
1 320 213 25K
2 453 302 44K
3 579 386 65K
4 687 458 85K
5 786 524 104K
6 885 590 124K
7 975 650 142K
8 990 660 151K
61. @guypod
Which Breakpoints To Use?
How Big & Complex Are Your Images?
• Your Analytics
point # Width Height File Size
1 320 213 9.0K
2 731 487 29K
3 990 660 40K
Source: Jason Grigsby,
“Sensible Jumps In Responsive Image File Sizes”
95. @guypod
Tip #5: Encode Well
• Quality Curve is NOT a Standard
• “Save For Web”is NOT just quality
• Decoding Is Standard, Encoding Is Not
• Notable Deltas: Chroma Subsampling, Per-Region
Quality, Lossy PNG, SSIM-Based Quality…
• If you use one tool: ImageOptim (benchmark)
96. @guypod
Tip #6:
Use Image Management Service
5 breakpoints * 2 Pixel Ratios * 3 Views *
5 thumbnails * 100,000 Products/Articles…
And tomorrow?
97. @guypod
Tip #6:
Use Image Management Service
5 breakpoints * 2 Pixel Ratios * 3 Views *
5 thumbnails * 100,000 Products/Articles…
And tomorrow?
/q75/w120/book.jpg GET /book.jpg
OriginTranscoder
<Big, High Res Img><Right-Sized Img>
100. @guypod
What Can You Do?
Enforce a Performance Budget
Image
Compression
Choose The
Right Format
Control Quality
Image
Loading
Use Responsive
Images
Prioritize Critical
Content
Image
Operations
Encode Well
Transcode in Proxy