94
Delivering Fast and Beautiful Images Doug Sillars @DougSillars DevDaysEU May 15, 2019

Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Delivering Fast and Beautiful Images

Doug Sillars

@DougSillars

DevDaysEU

May 15, 2019

Page 2: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Contact Me:

@DougSillars

[email protected]

www.dougsillars.com

Doug Sillars

Freelance Developer RelationsPerformance Audits: Web/NativeWorkshops: Performance/Images/Video/AR

http://bit.ly/HighPerformanceAndroidApps

Page 3: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue
Page 4: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

0.5

0.6

0.7

0.8

0.9

Standing in Line Standing on theedge of a virtual

cliff

ExperiencingMobile Delays

Solving a MathProblem

https://www.ericsson.com/res/docs/2016/mobility-report/emr-feb-2016-the-stress-of-steaming-delays.pdf

Stre

ss

Page 5: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Large Downloads Induce Delays in Rendering

3s: 53% of Users Abandon Mobile Sites

500ms: 26% Frustration8% Engagement

100ms: 1% Revenue Walmart & Amazon (Desktop 2001)

4% Mobile Users Throw Their Phones

https://www.doubleclickbygoogle.com/articles/mobile-speed-mattershttp://bit.ly/mobileWebStress http://www.globaldots.com/how-website-speed-affects-conversion-rates/https://www.mobilejoomla.com/blog/172-responsive-design-vs-server-side-solutions-infographic.html

Page 6: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Images Dominate the Web

HTTPArchive mobile websites 04/2019

Page 7: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

4 Simple Image Optimizations

Page 8: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

4 Simple Image Optimizations

1. Quality2. Format3. Sizing4. Lazy Loading

Page 9: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

4 Simple Image Optimizations

1. Quality2. Format3. Sizing4. Lazy Loading

Page 10: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

4 Simple Image Optimizations

Httparchive.org Webpagetest.org

Page 11: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

4 Simple Image Optimizations

1. Quality2. Format3. Sizing4. Lazy Loading

Page 12: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Quality

magick -quality 85 riga.jpg riga85.jpg

http://res.cloudinary.com/dougsillars/image/upload/q_85/v1520504964/IMG_20180301_114117_tzasan.jpg

Lighthouse: Recommends 85% quality on all images

https://developers.google.com/speed/docs/insights/OptimizeImages

Page 13: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

100%

3.6 MB

http://res.cloudinary.com/dougsillars/image/upload/v1529005982/IMG_20180614_184507_ssuk1i.jpg

Page 14: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

85%

1.87 MBq_85

http://res.cloudinary.com/dougsillars/image/upload/q_85/v1529005982/IMG_20180614_184507_ssuk1i.jpg

Page 15: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Quality Use “In The Wild”

500,000 mobile sites Analyzed 3/15/18

Page 16: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Quality Use “In The Wild”

Median Savings (50th percentile):

• 2.83 seconds faster page load• 419KB less data

Page 17: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

50%

914 KBq_50

http://res.cloudinary.com/dougsillars/image/upload/q_50/v1529005982/IMG_20180614_184507_ssuk1i.jpg

Page 18: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

20%

513 KBq_20

http://res.cloudinary.com/dougsillars/image/upload/q_20/v1529005982/IMG_20180614_184507_ssuk1i.jpg

Page 19: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Graphing the Results

https://developers.google.com/speed/docs/insights/OptimizeImages

Page 20: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Graphing the Results

https://developers.google.com/speed/docs/insights/OptimizeImages

Page 21: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Automate Quality vs. File Size

• Butteraugli

• SSIM: Structural SIMilarity

https://github.com/technopagan/cjpeg-dssim

cjpeg-dssim jpegoptim riga.jpg

http://res.cloudinary.com/dougsillars/image/upload/q_auto/v1529005982/IMG_20180614_184507_ssuk1i.jpg

Page 22: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

SSIM

1.46 MB

http://res.cloudinary.com/dougsillars/image/upload/q_auto/v1529005982/IMG_20180614_184507_ssuk1i.jpg

Page 23: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Graphing the Results

https://developers.google.com/speed/docs/insights/OptimizeImages

Page 24: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Results:

• Test Load on Motorola G4:

Page 25: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

4 Simple Image Optimizations

1. Quality2. Format3. Sizing4. Lazy Loading

Page 26: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Formats – Average Size

HTTPArchive mobile websites 15/02/18

Page 27: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Formats – Average Size

HTTPArchive mobile websites 15/02/18

Page 28: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Scalable Vector Graphics (SVG)Images drawn as shapes

infinitely scalable

XML - Can be added inline to HTML document

https://gist.github.com/hail2u/2884613?short_path=66a60ff

Page 29: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Scalable Vector Graphics (SVG)Images drawn as shapes

infinitely scalable

XML - Can be added inline to HTML document

https://gist.github.com/hail2u/2884613?short_path=66a60ff

Page 30: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Scalable Vector Graphics (SVG)

Page 31: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Scalable Vector Graphics (SVG)

Page 32: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Scalable Vector Graphics (SVG)

KB

Original 946

Optimized 1

Page 33: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Scalable Vector Graphics (SVG)

KB

Original 946

Optimized 1

Page 34: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Scalable Vector Graphics (SVG)

KB

Original 946

Optimized 1

GZip 687 bytes

Page 35: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Scalable Vector Graphics (SVG)

KB

Original 946

Optimized 1

GZip 687 bytes

Brotli 525 bytes

Page 36: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Scalable Vector Graphics (SVG)

KB

Original 946

Optimized 1

GZip 687 bytes

Brotli 525 bytes

Page 37: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Scalable Vector Graphics (SVG)

<style > .svgorange {filter: invert(.5) sepia(1)

saturate(5) hue-rotate(5deg);}

</style><img class="svgorange" src ="map-marker-circle.svg">

https://medium.com/@union_io/swapping-fill-color-on-image-tag-svgs-using-css-filters-fa4818bf7ec6

Page 38: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Scalable Vector Graphics (SVG)

Page 39: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Formats – Average Size

HTTPArchive mobile websites 15/02/18

Page 40: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Formats – PNGs

https://dougsillars.com/2019/02/10/using-screenshots-in-production/

Page 41: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Formats – Screenshots -> JPG

https://dougsillars.com/2019/02/10/using-screenshots-in-production/

Page 42: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Formats – Average Size

HTTPArchive mobile websites 15/02/18

Page 43: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

File Format: WebP

https://caniuse.com/#feat=webp

Page 44: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

SSIM + WebP

986 KB

http://res.cloudinary.com/dougsillars/image/upload/q_auto,f_auto/v1529005982/IMG_20180614_184507_ssuk1i.jpg

Page 45: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

File Format: Web

<picture><source width = "100%" type="image/webp" srcset=”riga.webp"><img width = "100%" src=”riga_cjpeg_dssim.jpg"

alt=”Riga, Latvia"></picture>

Page 46: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Format Use “In The Wild”

500,000 mobile sites Analyzed 3/15/18

Page 47: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Format Use “In The Wild”

500,000 mobile sites Analyzed 3/15/18

Page 48: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

4 Simple Image Optimizations

1. Quality2. Format3. Sizing4. Lazy Loading

Page 49: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Sizing

-

Page 50: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Sizing

Page 51: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Sizing

-

Page 52: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Sizing

624

832

-

Page 53: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Sizing

624

832

12,979,000 pixels

519,000 pixels_________________

-

12,460,000 pixels

Page 54: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Sizing

624

832

12,979,000 pixels

519,000 pixels_________________

-

12,460,000 pixels

Page 55: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Processing

1M pixels

Download (s) Image Decode (ms)

Desktop 14 78

Moto G4 14.2 218

Alcatel 1X 14.2 820

Page 56: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Sizing

https://twitter.com/paulcalvano/status/928751141843808256

Page 57: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Image Sizing

-

Responsive Images:

Generate a set of images25 KB difference in size

Page 58: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Responsive Images

624

832

625,000 pixels

-

106,000 pixels

519,000 pixels_________________

Page 59: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Responsive Breakpoint Generationhttps://github.com/cloudinary/responsive_breakpoints_generatorhttp://www.responsivebreakpoints.com/

Page 60: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Responsive Images

Page 61: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Responsive Images Use “In The Wild”

500,000 mobile sites Analyzed 3/15/18

Page 62: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Responsive Images Use “In The Wild”

442,000 mobile sites Analyzed 3/15/18

Page 63: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

4 Simple Image Optimizations

1. Quality2. Format3. Sizing4. Lazy Loading

Page 64: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Lazy Load

https://calendar.perfplanet.com/2017/progressive-image-loading-using-intersection-observer-and-sqip/

Page 65: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Lazy Load

https://calendar.perfplanet.com/2017/progressive-image-loading-using-intersection-observer-and-sqip/

Page 66: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Lazy Loading Use “In The Wild”

442,000 mobile sites Analyzed 3/15/18

Page 67: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Lazy Loading Use “In The Wild”

442,000 mobile sites Analyzed 3/15/18

Page 68: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Preview Images

Page 69: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Optimizing Content DeliveryPreview Images

https://github.com/technopagan/sqip

Page 70: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Lazy Loading: Experiments

Page 71: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Lazy Loading: Chrome Experiments

Page 72: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Lazy Loading: Chrome Experiments

Page 73: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Animated GIFs

Original MP41.4 MB

Page 74: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Animated GIFs

Page 75: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Animated GIFs

Animated GIF3.8 MB

270% larger

Page 76: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Animated GIFs

“The Graphics Interchange Format is not

intended as a platform for animation, even

though it can be done in a limited way.”

-GIF89a Specification

https://www.w3.org/Graphics/GIF/spec-gif89a.txt

Page 77: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Animated GIFs

Page 78: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Animated GIFs

MP4: 256 colors247KB

93% smaller

Page 79: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Animated GIFs: Social Media

Page 80: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Animated GIFs: Social Media

#FAKENEWS

Page 81: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Animated GIFs: Social Media

Page 82: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Animated GIFs: as Video!

Video Tags:<video loop autoplay muted playsinline controls = "false” src="goats.mp4”/>

Img tags are fast!<picture>

<source type="video/mp4" srcset=”goats.mp4"> <source type="image/webp" srcset=”goats.webp"> <img src=”goats.gif">

</picture>

https://calendar.perfplanet.com/2017/animated-gif-without-the-gif/

Page 83: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Animated GIFs

Page 84: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Addendum: What Are Your Customers Saying?

Page 85: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Addendum: Save-Data

Save-Data: on

Page 86: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Addendum: Save-Data

Page 87: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Addendum: Save-Dataq_auto -> q_auto:eco180KB -> 135 KB

https://res.cloudinary.com/dougsillars/image/upload/w_1400,q_auto/v1540978150/IMG_20181028_153301_okeb2b.jpg

Page 88: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Addendum 2: Network Info

Page 89: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Addendum 2: Network Info

// Network type that browser usesnavigator.connection.type;

// Effective bandwidth estimatenavigator.connection.downlink

// Effective round-trip time estimatenavigator.connection.rtt

// Upper bound on the downlink speed of the first network hopnavigator.connection.downlinkMax

Page 90: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Addendum 2: Network Info

// Network type that browser usesnavigator.connection.type;

// Effective bandwidth estimatenavigator.connection.downlink

// Effective round-trip time estimatenavigator.connection.rtt

// Upper bound on the downlink speed of the first network hopnavigator.connection.downlinkMax

500 KBPS

Page 91: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Conclusion

Optimize Image:QualityFormatSizingLazy Load if PossibleaGIFs to moviesNo Base64 Encoded ImagesMonitor Customer’s headers

Images VideoOptimize Image:

device screen (DPR?)only download if displayedBitrateStreaming is more efficientVideo can be expensive

Page 92: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Summary

Testing:WebPageTest https://www.webpagetest.orgHttpArchive https://httparchive.org

Images:ImageMagick https://www.imagemagick.orgSSIM https://github.com/technopagan/cjpeg-dssimLazySizes https://github.com/aFarkas/lazysizesResponsive Breakpoints http://www.responsivebreakpoints.com/

Cloudinary https://www.cloudinary.com

Tooling

Page 93: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Conclusion

Images CAN Be Beautiful AND Fast

Page 94: Delivering Beautiful and Fast Images and Video · Large Downloads Induce Delays in Rendering 3s: 53% of Users Abandon Mobile Sites 500ms: 26% Frustration 8% Engagement 100ms: 1% Revenue

Love Building with Video and Images?

Media Developer Expert

[email protected]

Become a