On Github yoavweiss / respimg-tag-presentation
W3C TAG F2F - London, January 2014
Load properly dimensioned images that fit the page's design in an efficient manner
who knows what the responsive image problem is?RWD became a thing
One code base to rule them all
Awesome
Not a problem!
Mobile experience became better, but slower
"a responsive site" became a synonym of "a slow site"
Serving the same resources to mobile and desktop hurts performance
On mobile the images are much smaller and some of them are not even displayed
Images - over 61%
Up to™ 72% image data savings
tkadlec.com A small utility I cooked up and Tim Kadlec wrote about showed 72% data savingsThe difference between low end, small devices and high-end wide devices increases
Devs can choose between HQ and LQ for everybody
Usually pick HQ
Sending images that match layout
Provide further context when necessary
Fit layout and optimal content without wasting bytes<picture> <source srcset="pic1x.jpg 1x, pic2x.jpg 2x, pic4x.jpg 4x"> <img alt="A rad wolf." src="pic1x.jpg"> </picture>or simply
<img srcset="pic1x.jpg 1x, pic2x.jpg 2x, pic4x.jpg 4x" alt="A rad wolf." src="pic1x.jpg">
<picture> <source media="(min-width: 45em)" srcset="large.jpg"> <source media="(min-width: 18em)" srcset="med.jpg"> <img src="small.jpg" alt="The president giving an award."> </picture>
<picture> <source media="(min-width: 45em)" srcset="large-1.jpg, large-2.jpg 2x"> <source media="(min-width: 18em)" srcset="med-1.jpg, med-2.jpg 2x"> <img src="small-1.jpg" srcset="small-1.jpg, small-2.jpg 2x" alt="The president giving an award."> </picture>
<picture> <source sizes="100%" srcset="pic400.jpg 400w, pic800.jpg 800w, pic1600.jpg 1600w"> <img src="pic400.jpg" alt="The president giving an award."> </picture>or simply
<img sizes="100%" srcset="pic400.jpg 400w, pic800.jpg 800w, pic1600.jpg 1600w" src="pic400.jpg" alt="The president giving an award.">
<picture> <source sizes="(max-width: 30em) 100%, (max-width: 50em) 50%, calc(33% - 100px)" srcset="pic100.jpg 100w, pic200.jpg 200w, pic400.jpg 400w, pic800.jpg 800w, pic1600.jpg 1600w, pic3200.jpg 3200w"> <img src="pic400.jpg" alt="The president giving an award."> </picture>or simply
<img sizes="(max-width: 30em) 100%, (max-width: 50em) 50%, calc(33% - 100px)" srcset="pic100.jpg 100w, pic200.jpg 200w, pic400.jpg 400w, pic800.jpg 800w, pic1600.jpg 1600w, pic3200.jpg 3200w" src="pic400.jpg" alt="The president giving an award.">
Implicitly relies on sizes
Server confirmation header
Used for intrinsic image sizing
Not sent on initial HTML request
336x635
106x200
211x400
336x635
770x512
200x200
400x288
770x512
No markup
single file
can download diff
complicated
decoding perf?
Fetching mechanism
RWD - http://www.flickr.com/photos/axbom/6263640150/sizes/o/in/photostream/
Bloat - http://www.flickr.com/photos/lorenjavier/5013332959/sizes/l/in/photostream/
CNN - http://mobile.smashingmagazine.com/2010/11/03/how-to-build-a-mobile-website/
Wap 2 site - http://www.coffeeshopdave.com/Helio_WAPv2.html
Lego - http://lego.wikia.com/wiki/Service_Crew_Member