58
IMAGE SCRIMMAGE A TECHY, STRETCHY ERIC PORTIS • SMASHINGCONF FREIBURG • 2015

A Techy, Stretchy Image Scrimmage

  • Upload
    eeeps

  • View
    1.317

  • Download
    2

Embed Size (px)

Citation preview

Page 1: A Techy, Stretchy Image Scrimmage

IMAGE SCRIMMAGE

A TECHY, STRETCHY

ERIC PORTIS • SMASHINGCONF FREIBURG • 2015

Page 2: A Techy, Stretchy Image Scrimmage

WHO?QUESTION #1

Page 3: A Techy, Stretchy Image Scrimmage
Page 4: A Techy, Stretchy Image Scrimmage
Page 5: A Techy, Stretchy Image Scrimmage

SHIP HAPPENS

Page 6: A Techy, Stretchy Image Scrimmage

★URBANA!

Page 7: A Techy, Stretchy Image Scrimmage

RESPONSIVE IMAGES COMMUNITY GROUP

http://ricg.io

Page 8: A Techy, Stretchy Image Scrimmage

WHAT!?QUESTION #2

Page 9: A Techy, Stretchy Image Scrimmage

<img>

Page 10: A Techy, Stretchy Image Scrimmage

src="insufficent"><img

Page 11: A Techy, Stretchy Image Scrimmage

WHY?QUESTION #3

Page 12: A Techy, Stretchy Image Scrimmage

BITMAPS ARE

FLUID

FIXED

THE WEB IS

vs.

Page 13: A Techy, Stretchy Image Scrimmage

BITMAP IMAGES ARE THE BIGGEST PERFORMANCE BOTTLENECK ON THE RESPONSIVE WEB

Page 14: A Techy, Stretchy Image Scrimmage

63%of the web is

IMAGEShttp://httparchive.org/interesting.php#bytesperpage

Page 15: A Techy, Stretchy Image Scrimmage

736 kb 2015

2011 228 kb

http://httparchive.org/trends.php#bytesImg&reqImg

Page 16: A Techy, Stretchy Image Scrimmage

30” Cinema Display 2560 x 1600

Page 17: A Techy, Stretchy Image Scrimmage

iPhone 6 Plus 2280 x 1242 (logical)

30” Cinema Display 2560 x 1600

Page 18: A Techy, Stretchy Image Scrimmage

iPhone 6 Plus 2280 x 1242 (logical)

30” Cinema Display 2560 x 1600

Retina iMac 5120 x 2880

Page 19: A Techy, Stretchy Image Scrimmage

1024 x 768 32%

1280 x 800 23%

1280 x 1024 11%

1440 x 900 10%

2009

OTHER 4%

OTHER 24%

1366 x 768 13%

1920 x 1080 9%

360 x 640 8%

768 x 1024 7%

2015http://statcounter.com

Page 20: A Techy, Stretchy Image Scrimmage

1024 x 768 32%

1280 x 800 23%

1280 x 1024 11%

1440 x 900 10%

http://statcounter.com2009

OTHER 4%

OTHER 24%

1366 x 768 13%

1920 x 1080 9%

360 x 640 8%

768 x 1024 7%

2015

Page 21: A Techy, Stretchy Image Scrimmage
Page 22: A Techy, Stretchy Image Scrimmage
Page 23: A Techy, Stretchy Image Scrimmage
Page 24: A Techy, Stretchy Image Scrimmage

VIEWPORT WIDTH WASTED IMAGE BYTES360px 72%

760px 53%

1260px 42%

http://timkadlec.com/2013/06/why-we-need-responsive-images/

Page 25: A Techy, Stretchy Image Scrimmage
Page 26: A Techy, Stretchy Image Scrimmage

TIM KADLEC: Mobile Image Processing

VIDEO: https://www.youtube.com/watch?v=jP68rCjSSjM SLIDES: https://speakerdeck.com/tkadlec/mobile-image-processing-at-velocity-sc-2015

Page 27: A Techy, Stretchy Image Scrimmage

ADAPTABILITY PRESENTS NEW OPPORTUNITIES FOR VISUAL DESIGN

Page 28: A Techy, Stretchy Image Scrimmage

The day after the release of the original iPhone

~10 years later

nytimes.com on a small screen

Page 29: A Techy, Stretchy Image Scrimmage

Cropping

Some sort of… mammal? Look at that adorable Portuguese Water dog!

Page 30: A Techy, Stretchy Image Scrimmage

Otherwise altering

Page 31: A Techy, Stretchy Image Scrimmage

Otherwise altering

Page 32: A Techy, Stretchy Image Scrimmage

HOW?QUESTION #4

Page 33: A Techy, Stretchy Image Scrimmage

LIVE CODING!x descriptors

Page 34: A Techy, Stretchy Image Scrimmage

2x = (min-device-pixel-ratio: 2) ?

Page 35: A Techy, Stretchy Image Scrimmage

NO!

Page 36: A Techy, Stretchy Image Scrimmage

IF the user’s device has a device-pixel-ratio >= 2 THEN load this resource.

NO EXCEPTIONS!

MEDIA QUERIES:

Page 37: A Techy, Stretchy Image Scrimmage

Hey, browser! Here are some fun facts about the available resources.

SRCSET DESCRIPTORS:

YOU DECIDE!

Page 38: A Techy, Stretchy Image Scrimmage

x 2x

<img>large.jpg

Page 39: A Techy, Stretchy Image Scrimmage

2x = this resource has an “image density” of 2!

Page 40: A Techy, Stretchy Image Scrimmage

resource width in pixels — <img>’s width on the layout in CSS px

= image density e.g., 2x

..

Page 41: A Techy, Stretchy Image Scrimmage
Page 42: A Techy, Stretchy Image Scrimmage

medium.jpg is 640 pixels wide — its <img> has a width of 640 px on the layout

= medium.jpg has an image density of 1x

..

Page 43: A Techy, Stretchy Image Scrimmage

large.jpg is 1280 pixels wide — its <img> has a width of 640 px on the layout

= large.jpg has an image density of 2x

..

Page 44: A Techy, Stretchy Image Scrimmage

resource width — <img>’s width on the layout

= image density

..

Page 45: A Techy, Stretchy Image Scrimmage

x descriptors only work for fixed-width images!

Page 46: A Techy, Stretchy Image Scrimmage

LIVE CODING!w and sizes

Page 47: A Techy, Stretchy Image Scrimmage

LIVE CODING!picture and media

Page 48: A Techy, Stretchy Image Scrimmage

TAYLOR HUNT: When Responsive Images Get Ugly

http://codepen.io/Tigt/blog/when-responsive-images-get-ugly

Page 49: A Techy, Stretchy Image Scrimmage

LIVE CODING!picture and type

Page 50: A Techy, Stretchy Image Scrimmage

“Groovy”

Page 51: A Techy, Stretchy Image Scrimmage

WHEN?QUESTION #5

Page 52: A Techy, Stretchy Image Scrimmage

NOW!

Page 53: A Techy, Stretchy Image Scrimmage

X W + SIZES PICTURE

CHROME 34+ 38+ 38+

OPERA 21+ 25+ 25+

FIREFOX 38+ 38+ 38+

IE Nope.

EDGE 12+ 12+ SOON!

SAFARI 7.1+ 9+ ? *

* But probably soonish

Page 54: A Techy, Stretchy Image Scrimmage

X W + SIZES PICTURE

ANDROID STOCK Nope.

CHROME FOR ANDROID 44+ 44+ 44+

OPERA MINI Impossible?

IE MOBILE Nada.

EDGE MOBILE Probably!

iOS SAFARI 7.1+ 9+ ? *

* But probably soonish

Page 55: A Techy, Stretchy Image Scrimmage

ENHANCE <img src=“mobile-first.jpg” srcset=“progressive.jpg 640w, enhancement.jpg 1280w, works.jpg 1920w” alt=“Really.” />

Page 56: A Techy, Stretchy Image Scrimmage

https://scottjehl.github.io/picturefill/

POLYFILL WHEN YOU NEED TO

Picturefill!

Page 57: A Techy, Stretchy Image Scrimmage

image-set(): lets you use srcset syntax in CSS

Client Hints: let you do srcset-y things on the server

Container Queries: The RICG’s next trick?

WICG: Everyday developers shaping the web

EXTRA CREDIT

Page 58: A Techy, Stretchy Image Scrimmage

THANKS!ericportis.com

@etportis P.S. I write a fortnightly respimg newsletter!

Sign up here: ricg.io